00001 #include <stdio.h> 00002 #include <signal.h> 00003 #include <execinfo.h> 00004 #include "backtrace.h" 00005 00006 void show_stackframe(FILE *fp) { 00007 void *trace[32]; 00008 char **messages = (char **)NULL; 00009 int i, trace_size = 0; 00010 00011 trace_size = backtrace(trace, 32); 00012 messages = backtrace_symbols(trace, trace_size); 00013 fprintf(fp,"BACKTRACE: Execution path:\n"); 00014 for (i=0; i<trace_size; ++i) 00015 fprintf(fp,"BACKTRACE: %s\n", messages[i]); 00016 }