How to get a full call stack in Visual Studio 2005

2019-04-09 15:02发布

问题:

How can I get a full call stack for a c++ application developed with Visual Studio 2005? I would like to have a full call stack including the code in the system libraries.

Do I have to change some settings in Visual Studio, or do I have to install additional software?

回答1:

  1. Get debug information for all project dependencies. This is specified under the "Configuration Properties -> C/C++ -> General" section of the project properties.

  2. On the menu, go to "Tools -> Options" then select "Debugging -> Symbols".

  3. Add a new symbol location (the folder icon) that points to Microsoft's free symbol server “symsrvsymsrv.dllc:\symbols*http://msdl.microsoft.com/downloads/symbols“

  4. Fill out the "cache symbols" field with some place locally so you don't go to the internet all the time.



回答2:

Agree with Clay, but for Symbols Server you should get the latest symsrv.DLL from "Debugging Tools For Windows", a free Microsoft download.

(Since you explicitly asked what you need to download, I presume you don't have it yet)



回答3:

Or, optionally (assuming that Visual Studio is not installed), grab a copy of Windows Debugging Tools, install and either run your app from within the debugger (windbg.exe) or have it attach to an already running app:

windbg[.exe] -pn program.exe
or
windbg[.exe] -p process_id

Break in the debugger at the point you want to observe for stack trace (Ctrl+Break). Switch to the thread of interest (most probably the main thread of execution):

~0s

Fix up symbols for system modules (and probably for the app as well if available):

* fix up symbols for app
.sympath path_to_app_symbols
* configure where debugger will download and store system symbols
.symfix+ path_where_system_symbols_will_be_stored
* force debugger to reload symbols
.reload

Issue a call stack command:

kb