I have an Objective-C app build on Linux with GCC 4.3 using no specific framework (only GNU-runtime). I am using Objective-C exceptions (via the '-fobjc-exceptions' compiler flag).
Now I want to print the stack trace of such an exception when I caught some. Or what would make me even happier: put the trace in a string or some kind of structure to evaluate or print it later on.
How can that be achieved?
Since no more knowledge is floating in, here is what I found out by myself:
At least under Linux I can use the GNU extensions
backtraceandbacktrace_symbolsto get addresses of the call stack and the corresponding symbols. This helps a little but is far away from the information that gdb gives. There are neither line numbers nor arguments values.With the glibc extension
dladdrI can get similar information but not further.This is still not exactly what I'm looking for but no one got so clause – so I would accept my own answer :(.