Discussion:
How to debug/trace deadlock situations that cause program to hang/non-responsive?
(too old to reply)
learnyourabc
2007-10-24 06:09:54 UTC
Permalink
I included the Crash Report below in all my MFC app for release mode
so that I can debug the error using the crash.bmp files and windbg.
http://www.codeproject.com/debug/XCrashReportPt3.asp
It has been very useful in tracing a problem.

But how do I debug or trace a simple multithreaded program that will
not crash but will hang or not responsive to user at all. There could
be deadlock situations that cause this. How to trace this problem?
Assuming that you are running the release version and it is not run in
any debugger(you can't do break all then go to thread windows to see)
when the deadlock situation occur.
Does anyone out there know how to do this kind of debugging or
tracing. Any suggestions or tutorials on how to tackle such problems?
I know you can add some log statements to see where it hangs but there
must be a better solution. Be able to see the threads that are running
and where in the code that it is looping or waiting similar to the
crash dump file........
learnyourabc
2007-10-24 06:23:55 UTC
Permalink
Can I somehow attach the current deadlock process running to my
debugger such as the windbg and determine the thread that is causing
this? Any tutorial or help manual on how this can be done?
Gregory Lin (rainnight at yahoo dot com)
2007-10-24 22:38:00 UTC
Permalink
Attach Debugger, Break All, Examine each thread

or use windbg to exam locks
Post by learnyourabc
I included the Crash Report below in all my MFC app for release mode
so that I can debug the error using the crash.bmp files and windbg.
http://www.codeproject.com/debug/XCrashReportPt3.asp
It has been very useful in tracing a problem.
But how do I debug or trace a simple multithreaded program that will
not crash but will hang or not responsive to user at all. There could
be deadlock situations that cause this. How to trace this problem?
Assuming that you are running the release version and it is not run in
any debugger(you can't do break all then go to thread windows to see)
when the deadlock situation occur.
Does anyone out there know how to do this kind of debugging or
tracing. Any suggestions or tutorials on how to tackle such problems?
I know you can add some log statements to see where it hangs but there
must be a better solution. Be able to see the threads that are running
and where in the code that it is looping or waiting similar to the
crash dump file........
learnyourabc
2007-10-26 07:23:00 UTC
Permalink
I,m using windbg attach to process and .dump /ma dump.dmp for the
hanged process. Also using ADPlus adplus -hang -pn myapp.exe to
generate dumps for the hanged process every 30 secs for 3 or 4 times
to see what is causing the process to hang.

Loading...