From: hno <> Date: Tue, 30 May 2000 15:30:10 +0000 (+0000) Subject: hno squid-2.4.DEVEL3-hno.devel.automatic_stacktraces.patch X-Git-Tag: SQUID_3_0_PRE1~1949 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ce3d30fb60b8850a44bac40c8d5957ea479f3bbe;p=thirdparty%2Fsquid.git hno squid-2.4.DEVEL3-hno.devel.automatic_stacktraces.patch Added --enable-stacktraces configure option to set PRINT_STACK_TRACE, and extended support for this to Linux/GNU libc. --- diff --git a/ChangeLog b/ChangeLog index 6079e7ebc9..123d54983c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -60,6 +60,8 @@ Changes to Squid (): manager. - Fixed a bogous MD5 mismatch warning sometimes seen when using aufs or diskd stores + - Added --enable-stacktraces configure option to set PRINT_STACK_TRACE, + and extended support for this to Linux/GNU libc. Changes to Squid-2.4.DEVEL3 (): diff --git a/configure.in b/configure.in index 5ec9a453b3..599a7000bc 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.189 2000/05/29 01:13:47 wessels Exp $ +dnl $Id: configure.in,v 1.190 2000/05/30 09:30:10 hno Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.189 $)dnl +AC_REVISION($Revision: 1.190 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(cfgaux) @@ -635,6 +635,15 @@ if test -n "$AUTH_MODULES"; then fi AC_SUBST(AUTH_MODULES) +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 @@ -699,6 +708,7 @@ AC_CHECK_HEADERS( \ crypt.h \ ctype.h \ errno.h \ + execinfo.h \ fcntl.h \ getopt.h \ gnumalloc.h \ @@ -1069,6 +1079,7 @@ fi dnl Check for library functions AC_CHECK_FUNCS(\ bcopy \ + backtrace_symbols_fd \ crypt \ fchmod \ getdtablesize \ diff --git a/src/tools.cc b/src/tools.cc index f0c45b8309..855c898ba8 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.191 2000/05/16 07:06:07 wessels Exp $ + * $Id: tools.cc,v 1.192 2000/05/30 09:30:10 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -254,6 +254,14 @@ death(int sig) 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