blob: 252e4dd7248f7e363ffc3bbdce2540f5b205198f [file] [log] [blame]
paulfb2d1502003-06-04 09:40:54 +00001#include <zebra.h>
2#include "log.h"
3
4void
5debug_print_trace (int signal)
6{
hassofa2b17e2004-03-04 17:45:00 +00007#ifdef HAVE_GLIBC_BACKTRACE
paulfb2d1502003-06-04 09:40:54 +00008 void *array[10];
9 size_t size;
10 char **strings;
11 size_t i;
12
13 size = backtrace (array, 10);
14 strings = backtrace_symbols (array, size);
15
16 printf ("Obtained %zd stack frames.\n", size);
17
18 for (i = 0; i < size; i++)
19 printf ("%s\n", strings[i]);
20
21 free (strings);
hassofa2b17e2004-03-04 17:45:00 +000022#endif /* HAVE_GLIBC_BACKTRACE */
paulfb2d1502003-06-04 09:40:54 +000023
24 exit(1);
25}