7 #define MAX_TRACE_LEN 100
9 /** Print a backtrace of the current program state. */
10 void print_trace(void)
12 void *array[MAX_TRACE_LEN];
16 size = backtrace(array, MAX_TRACE_LEN);
17 strings = backtrace_symbols(array, size);
19 printf("\nDumping stack trace (%d frames):\n", size);
21 for (i = 0; i < size; i++)
22 printf("\t%s\n", strings[i]);