开发者

how to debug the code which is hang [closed]

It&开发者_StackOverflow#39;s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

I have a multithreaded code which is hang in some case. I want to know what's the recommended way to debug?


When it hangs, you can attach the debugger and inspect thread state, including callstacks, to your heart's content. Often there will be one (or more) thread(s) that is (are) in a wait state, and you might be able to work out why that is.

If the state is not self-explanatory at the time of the hang, you can resort to techniques suggested to provide context information for the preceding program flow.


Because it is multi-threaded, you can't debug such as setting breakpoints, trace the statements and pause to see the values of the variables. The only way in my opinion is to print to the console and see the status from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜