Boost logo

Boost :

Subject: Re: [boost] [Backtrace] Any interest in portable stack trace?
From: Lassi Tuura (lat_at_[hidden])
Date: 2010-10-21 04:44:46


Hi,

> Linux, Solaris and Mac OS X have functions backtrace and backtrace_symbols
> in libc: See: http://linux.die.net/man/3/backtrace
>
> Windows starting from XP has RtlCaptureBackTrace in kernel32.dll:
> See http://msdn.microsoft.com/en-us/library/ff552119(VS.85).aspx
>
> So the rest is translate symbols, under Unixes I have dladdr and under Windows
> dbghelp.

One recommendation, decide early on limitations.

I recommend to choose from the beginning:
- whether it should work in asynchronous interrupts such as signal handlers,
- whether it should work when the program is unstable, such as memory fault handlers, and
- how good a performance to expect.

At least the linux variety of backtrace() has limitations in all the above areas. Getting an occasional stack trace in application execution flow, say debug output or throwing an exception is definitely ok. The function works well enough in many common crash situations, but will fail in somewhat unpleasant ways in certain circumstances.

Regards,
Lassi


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk