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 ?
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 ?
StackWalk64 in the dbghelp.dll library should do what you're looking for.
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.
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.