Generating C++ BackTraces in OS/X (10.5.7)
- by phillipwei
I've been utilizing backtrace and backtrace_symbols to generate programmatic stack traces for the purposes of logging/diagnosis. It seems to roughly work, however, I'm getting a little bit of mangling and there are no accompanying file/line numbers associated with each function invocation (as I'd expect within a gdb bt call or something). Here's an example:
1 leonardo 0x00006989 _ZN9ExceptionC2E13ExceptionType + 111
2 leonardo 0x00006a20 _ZN9ExceptionC1E13ExceptionType + 24
3 leonardo 0x0000ab64 _ZN5Rules11ApplyActionER16ApplicableActionR9GameState + 1060
4 leonardo 0x0000ed15 _ZN9Simulator8SimulateEv + 2179
5 leonardo 0x0000eec9 _ZN9Simulator8SimulateEi + 37
6 leonardo 0x00009729 main + 45
7 leonardo 0x000025c6 start + 54
Anything I'm missing something, doing something silly, or is this all I can expect out of backtrace on OS/X?
Some other tidbits:
I don't see a rdynamic link option for the g++ version (4.0.1) I'm using.
-g/-g3 doesn't make any difference.
abi::__cxa__demangle doesn't seem to do anything