Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Print a symbolicated stack trace
#import <execinfo.h>
#import <stdio.h>
void PrintStackTrace(void)
{
void* callstack[128];
int i, frames = backtrace(callstack, 128);
char** strs = backtrace_symbols(callstack, frames);
for (i = 0; i < frames; ++i) {
printf("%s\n", strs[i]);
}
free(strs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment