Re: Hanging program and call stack.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




In addition to others...

Is the call-stack reliable when breaking a process? The reason for
asking is that we experience problems with a C++ program that hangs for
some unknown reason. We start the process from Java and the program
very quickly becomes irresponsive. When we attach the program via the
debugger from the 7.1 IDE and break the program, we are told that the
program is soft broken, but the back trace does not seem correct - it
is at a return statement in an innocent looking function (no - there
are no destructors that should be run).

Reliability of the call stack can depend on the approach used by the debugger
to break into the process in case of deadlock. There are some approaches
where the debugger attempts to change the current instruction pointer,
and in some circumstances it probably can lead to incorrect call stack
(though I don't know whether VS2003 debugger uses such techniques).

Because of this, IMO it is better to use a debugger that supports non-invasive
mode of operation (that is, simply suspends all threads in the target) -
WinDbg/CDB or ADPlus in hang mode, as Livven suggested.

Absence of symbols for some modules can also affect the quality of
call stacks (again, WinDbg family offers better control over symbol loading
than VS2003).

After attaching the debugger, collect at least two dumps, one after another,
then use WinDbg to analyze call stacks (and compare them between the dumps,
to see if the process is really stuck, or if some threads are still running).
!runaway and !locks commands should usually be useful, you can
find some samples here:
http://www.debuginfo.com/articles/easywindbg.html#debugdeadlocks

Tracing also can be very effective when tracking down deadlocks.

Regards,
Oleg
[VC++ MVP http://www.debuginfo.com/]







.



Relevant Pages

  • Re: Catch the line of exception
    ... the dump and with the pdb file you can get the stack trace" ... How to obtain an app's or COM object's memory dump? ... a JIT debugger from WinDbg family ...
    (microsoft.public.vc.language)
  • Re: Interpretting the symbols (WinDbg)
    ... "Arkady Frenkel" wrote in message ... > Maybe better to debug that either in VB or/and VC studio and not WinDbg. ... And the stack has something to with the kernel interfacing. ... The stack that I get in vc debugger is ...
    (microsoft.public.vc.atl)
  • Re: Interpretting the symbols (WinDbg)
    ... "Arkady Frenkel" wrote in message ... > Maybe better to debug that either in VB or/and VC studio and not WinDbg. ... And the stack has something to with the kernel interfacing. ... The stack that I get in vc debugger is ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Need Help Debugging
    ... you should use straight and plain ADPlus.VBS from the debugger package. ... debug info loaded, etc... ... does that avoid using the stack ?!? ... which is our custom CRITICAL_SECTION class. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: HttpModules - Webservices
    ... with a native debugger. ... >Hi Scott, ... >before it hangs. ... >>>HttpRequest request) ...
    (microsoft.public.dotnet.framework.aspnet)