Printing the stack trace in C++ (MSVC)?


Question

In my C++ application (developed with Visual Studio 2003) and Qt4, I'd like to print the stack trace from a specific line of code, either to the console output or into a file.

What would it take ? Is Qt of any help to do this ?

1
9
10/15/2009 9:30:25 PM

Accepted Answer

StackWalker by Jochen Kalmbach [MVP VC++] and available on codeproject is probably the easiest way to do this. It wraps up all of the details of dealing with the underlying StackWalk64 API.

10
11/19/2008 2:14:36 PM

It's not in the public Qt API, but if you look in

$QTDIR/src/corelib/kernel/qcrashhandler.*

you can see the beginnings of a cross-platform implementation of exactly this.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon