|
Boost : |
Subject: Re: [boost] [Backtrace] Any interest in portable stack trace?
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-10-21 01:10:09
>
> My experience is that the stack is difficult to follow in debug builds
> and close to impossible in release builds. Highly optimized code sometimes
> discards the notion of a stack altogether in certain cases.
>
> I'm curious how you're going to accomplish this feat and make it portable
too?
>
> If you are successful, this would definitely be a valuable tool to have.
Because I'm not trying to reinvent the wheel:
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.
Of course for inlined functions or for functions with omitted frame pointer
you'll
not see their frame it the trace, but for rest of it, it should work.
Artyom
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk