* squid-2.4.DEVEL3-hno.devel.automatic_stacktraces.patch * --enable-stacktraces configure option to set PRINT_STACK_TRACE, and extends support for this to Linux/GNU libc. Index: squid/acconfig.h diff -u squid/acconfig.h:1.1.1.3.6.5.2.2 squid/acconfig.h:1.1.1.3.6.5.2.3 --- squid/acconfig.h:1.1.1.3.6.5.2.2 Tue May 16 11:53:51 2000 +++ squid/acconfig.h Tue May 16 12:38:15 2000 @@ -280,3 +280,6 @@ /* Define if you want to set the COSS membuf size */ #undef COSS_MEMBUF_SZ + +/* Print stacktraces on fatal errors */ +#undef PRINT_STACK_TRACE Index: squid/configure.in diff -u squid/configure.in:1.1.1.3.6.7.2.8 squid/configure.in:1.1.1.3.6.7.2.9 --- squid/configure.in:1.1.1.3.6.7.2.8 Tue May 16 11:53:51 2000 +++ squid/configure.in Tue May 16 12:38:15 2000 @@ -701,6 +701,15 @@ AC_SUBST(OPT_UNLINKD_EXE) AC_SUBST(UNLINKD_OBJS) +dnl Enable backtraces on fatal errors +AC_ARG_ENABLE(stacktraces, +[ --enable-stacktraces Enable automatic call backtrace on fatal errors], +[ if test "$enableval" = "yes" ; then + echo "Enabling automatic stack backtraces on fatal errors" + AC_DEFINE(PRINT_STACK_TRACE, 1) + fi +]) + # Force some compilers to use ANSI features # case "$host" in @@ -765,6 +774,7 @@ crypt.h \ ctype.h \ errno.h \ + execinfo.h \ fcntl.h \ getopt.h \ gnumalloc.h \ @@ -1124,6 +1134,7 @@ dnl Check for library functions AC_CHECK_FUNCS(\ bcopy \ + backtrace_symbols_fd \ crypt \ fchmod \ getdtablesize \ Index: squid/src/tools.c diff -u squid/src/tools.c:1.1.1.3.6.1.2.1 squid/src/tools.c:1.1.1.3.6.1.2.2 --- squid/src/tools.c:1.1.1.3.6.1.2.1 Tue May 16 11:53:53 2000 +++ squid/src/tools.c Tue May 16 12:38:16 2000 @@ -254,6 +254,14 @@ fflush(stdout); } #endif /* _SQUID_SOLARIS_ */ +#if HAVE_BACKTRACE_SYMBOLS_FD + { + static void *(callarray[8192]); + int n; + n = backtrace(callarray, 8192); + backtrace_symbols_fd(callarray, n, fileno(debug_log)); + } +#endif #endif /* PRINT_STACK_TRACE */ #if SA_RESETHAND == 0