--------------------- PatchSet 309 Date: 2000/05/16 19:38:15 Author: hno Branch: hno-devel Tag: (none) Log: --enable-stacktraces configure option for setting PRINT_STACK_TRACE, and extended support for this to Linux/GNU libc. Members: acconfig.h:1.1.1.3.6.5.2.2->1.1.1.3.6.5.2.3 configure.in:1.1.1.3.6.7.2.8->1.1.1.3.6.7.2.9 src/tools.c:1.1.1.3.6.1.2.1->1.1.1.3.6.1.2.2 Index: squid/acconfig.h =================================================================== RCS file: /cvsroot/squid-sf//squid/Attic/acconfig.h,v retrieving revision 1.1.1.3.6.5.2.2 retrieving revision 1.1.1.3.6.5.2.3 diff -u -r1.1.1.3.6.5.2.2 -r1.1.1.3.6.5.2.3 --- squid/acconfig.h 16 May 2000 18:53:51 -0000 1.1.1.3.6.5.2.2 +++ squid/acconfig.h 16 May 2000 19:38:15 -0000 1.1.1.3.6.5.2.3 @@ -20,7 +20,7 @@ * */ @ TOP @ -/* $Id: acconfig.h,v 1.1.1.3.6.5.2.2 2000/05/16 18:53:51 hno Exp $ */ +/* $Id: acconfig.h,v 1.1.1.3.6.5.2.3 2000/05/16 19:38:15 hno Exp $ */ /********************************* * START OF CONFIGURABLE OPTIONS * @@ -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 =================================================================== RCS file: /cvsroot/squid-sf//squid/configure.in,v retrieving revision 1.1.1.3.6.7.2.8 retrieving revision 1.1.1.3.6.7.2.9 diff -u -r1.1.1.3.6.7.2.8 -r1.1.1.3.6.7.2.9 --- squid/configure.in 16 May 2000 18:53:51 -0000 1.1.1.3.6.7.2.8 +++ squid/configure.in 16 May 2000 19:38:15 -0000 1.1.1.3.6.7.2.9 @@ -3,13 +3,13 @@ dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.1.1.3.6.7.2.8 2000/05/16 18:53:51 hno Exp $ +dnl $Id: configure.in,v 1.1.1.3.6.7.2.9 2000/05/16 19:38:15 hno Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.1.1.3.6.7.2.8 $)dnl +AC_REVISION($Revision: 1.1.1.3.6.7.2.9 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(cfgaux) @@ -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 =================================================================== RCS file: /cvsroot/squid-sf//squid/src/tools.c,v retrieving revision 1.1.1.3.6.1.2.1 retrieving revision 1.1.1.3.6.1.2.2 diff -u -r1.1.1.3.6.1.2.1 -r1.1.1.3.6.1.2.2 --- squid/src/tools.c 16 May 2000 18:53:53 -0000 1.1.1.3.6.1.2.1 +++ squid/src/tools.c 16 May 2000 19:38:16 -0000 1.1.1.3.6.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.1.1.3.6.1.2.1 2000/05/16 18:53:53 hno Exp $ + * $Id: tools.c,v 1.1.1.3.6.1.2.2 2000/05/16 19:38:16 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -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