Re: Debugging a Hung Program
- From: "Oleg Starodumov" <com-dot-debuginfo-at-oleg>
- Date: Fri, 13 Jan 2006 13:22:20 -0800
> Any idea how to find out the thread stacks of a running but hung process
> (developed using Visual Studio 6.0, C++ environment)? In the Solaris/UNIX
> world there's a command called "pstack" that dumps out the stack of each
> thread given a process ID. Is there a tool that provides this kind of
> information on Windows either thru the visual studio environment or command
> line? Thanks in advance.
>
Yes, for example you can use CDB, which is available as part of Debugging Tools
for Windows package:
http://www.microsoft.com/whdc/ddk/debugging/default.mspx
The following command will attach to the application (by process id) and dump
call stacks of all threads:
cdb -pv -p <processid> -c "~*kb;q"
If you are debugging a hung application, it is even better to use it like this:
cdb -pv -p <processid> -c "~*kb;!locks;q"
(!locks command will display the information about all critical sections held by
the application's threads).
Good symbols for the operating system DLLs are usually required to get good call stacks.
You can set _NT_SYMBOL_PATH environment variable to the following value:
srv*c:\symbols*http://msdl.microsoft.com/download/symbols
Then CDB will automatically download the necessary symbols from symbol server
in Microsoft. (c:\symbols is a symbol cache, which can be any directory on your system).
You can find more information on these topics in Debugging Tools' documentation.
WinDbg debugger (also available with Debugging Tools) can run the same commands
from GUI.
Regards,
Oleg
[VC++ MVP http://www.debuginfo.com/]
.
- Prev by Date: Re: Problem after stopping the debugger
- Next by Date: Re: MiniDump & VC++ Runtime Error
- Previous by thread: Problem after stopping the debugger
- Next by thread: Re: MiniDump & VC++ Runtime Error
- Index(es):
Relevant Pages
|