paul | fb2d150 | 2003-06-04 09:40:54 +0000 | [diff] [blame] | 1 | #include <zebra.h> |
| 2 | #include "log.h" |
| 3 | |
| 4 | void |
| 5 | debug_print_trace (int signal) |
| 6 | { |
hasso | fa2b17e | 2004-03-04 17:45:00 +0000 | [diff] [blame] | 7 | #ifdef HAVE_GLIBC_BACKTRACE |
paul | fb2d150 | 2003-06-04 09:40:54 +0000 | [diff] [blame] | 8 | 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); |
hasso | fa2b17e | 2004-03-04 17:45:00 +0000 | [diff] [blame] | 22 | #endif /* HAVE_GLIBC_BACKTRACE */ |
paul | fb2d150 | 2003-06-04 09:40:54 +0000 | [diff] [blame] | 23 | |
| 24 | exit(1); |
| 25 | } |