qt-interest@trolltech.com
[Top] [All Lists]

Getting a stack trace

Subject: Getting a stack trace
From: Keith Sabine
Date: Thu, 14 Oct 2004 18:15:04 +0100
This is perhaps a bit off-topic for Qt, but something I've been thinking about
recently. I'd like to be able to determine the call stack if  my application
should crash, and write it out to the log file. Ideally save the file name and
line number where the crash occurred. Then any user who has a crash
can send me the log file.

As far as I can see there are two ways to go:  create a kind of guard class
and push/pop function name info onto a stack. The downside is (a) the
performance penalty (not huge) but more (b) I have to modify every
function in my code. But it would work with release builds.

The alternative is to get info from the stack itself, but that is going to be
horribly non-portable and will only give useful information if the code is
compiled in debug mode.

Has anyone else tried this? Any pointers to any possible solutions?

- Keith

--
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>