tags:

views:

1654

answers:

3

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  A: 

StackWalk64 in the dbghelp.dll library should do what you're looking for.

Nik
+3  A: 

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.

Len Holgate
A: 

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.

Michael Bishop