slygamer
Active Member
I'm trying to output the callstack, or backtrace, in my programs if an assert fails. I'm using the following code which seems to be the proper way to call the backtrace functions.
This only gives me the hex addresses of the functions, even with the -rdynamic flag passed to the linker as suggested by the documentation found on the web. Yet gdb can give the addresses plus the function names and parameter values with the 'bt' command.
Does anyone have any ideas on this? Does anyone else even use the backtrace functions?
Code:
void *stack[32];
unsigned long stackSize = backtrace(stack, 32);
char **strings = backtrace_symbols(stack, stackSize);
for (int j = 1; j < stackSize; ++j)
printf(strings[j]);
Does anyone have any ideas on this? Does anyone else even use the backtrace functions?