diff options
Diffstat (limited to 'lib/debug.c')
-rw-r--r-- | lib/debug.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/debug.c b/lib/debug.c new file mode 100644 index 00000000..c4b67a52 --- /dev/null +++ b/lib/debug.c @@ -0,0 +1,23 @@ +#include <zebra.h> +#include "log.h" + +void +debug_print_trace (int signal) +{ + void *array[10]; + size_t size; + char **strings; + size_t i; + + size = backtrace (array, 10); + strings = backtrace_symbols (array, size); + + printf ("Obtained %zd stack frames.\n", size); + + for (i = 0; i < size; i++) + printf ("%s\n", strings[i]); + + free (strings); + + exit(1); +} |