diff options
author | paul <paul> | 2003-06-04 11:40:54 +0200 |
---|---|---|
committer | paul <paul> | 2003-06-04 11:40:54 +0200 |
commit | fb2d1502bb0893f2aaccb49fb39521974078d96a (patch) | |
tree | 0d3059d875d2be20913eaceaed12c8c09ec2b481 /lib/debug.c | |
parent | Paul Jakma: acconfig.h is deprecated. (diff) | |
download | frr-fb2d1502bb0893f2aaccb49fb39521974078d96a.tar.xz frr-fb2d1502bb0893f2aaccb49fb39521974078d96a.zip |
Paul Jakma:
lib/debug.{c,h}: glibc backtrace printing function (from the glibc info page)
configure.ac: check for glibc backtrace and set define
lib/zebra.h: glibc backtrace support
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 000000000..c4b67a52a --- /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); +} |