X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Fdebug.c;h=ed036e48599056208a027e9fa3a55d9455ee5e32;hb=fb2bd066c2f8b34addafe48d62550e3033a59431;hp=a6de4154c5efcf350f3bd7a5947649e7c8e7e06c;hpb=a6127998ee6dcab6bb034f6ca985b07804a86f9a;p=debian%2Famanda diff --git a/common-src/debug.c b/common-src/debug.c index a6de415..ed036e4 100644 --- a/common-src/debug.c +++ b/common-src/debug.c @@ -37,6 +37,10 @@ #include "timestamp.h" #include "conffile.h" +#ifdef HAVE_GLIBC_BACKTRACE +#include +#endif + /* Minimum file descriptor on which to keep the debug file. This is intended * to keep the descriptor "out of the way" of other processing. It's not clear * that this is required any longer, but it doesn't hurt anything. @@ -159,6 +163,16 @@ debug_logging_handler(const gchar *log_domain G_GNUC_UNUSED, fflush(stderr); } +#ifdef HAVE_GLIBC_BACKTRACE + /* try logging a traceback to the debug log */ + if (db_fd != -1) { + void *stack[32]; + int naddrs; + naddrs = backtrace(stack, sizeof(stack)/sizeof(*stack)); + backtrace_symbols_fd(stack, naddrs, db_fd); + } +#endif + /* we're done */ if (log_level & G_LOG_LEVEL_CRITICAL) exit(error_exit_status);