[dovecot-cvs] dovecot/src/lib Makefile.am, 1.66, 1.67 backtrace-string.c, 1.1, 1.2 backtrace-string.h, 1.1, 1.2 failures.c, 1.30, 1.31

tss at dovecot.org tss at dovecot.org
Sun Nov 19 13:30:46 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv27173/src/lib

Modified Files:
	Makefile.am failures.c 
Added Files:
	backtrace-string.c backtrace-string.h 
Log Message:
Since getting core dumps can be sometimes difficult, if we now do abort()
ourself, we first log the backtrace. This works at least with Linux and
Solaris.



Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/Makefile.am,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- Makefile.am	16 Aug 2006 15:54:58 -0000	1.66
+++ Makefile.am	19 Nov 2006 13:30:41 -0000	1.67
@@ -1,6 +1,7 @@
 noinst_LIBRARIES = liblib.a
 
 liblib_a_SOURCES = \
+	backtrace-string.c \
 	base64.c \
 	bsearch-insert-pos.c \
 	buffer.c \
@@ -89,6 +90,7 @@
 noinst_HEADERS = \
 	array.h \
 	array-decl.h \
+	backtrace-string.h \
 	base64.h \
 	bsearch-insert-pos.h \
 	buffer.h \



Index: failures.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/failures.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- failures.c	18 Nov 2006 14:04:17 -0000	1.30
+++ failures.c	19 Nov 2006 13:30:41 -0000	1.31
@@ -2,6 +2,7 @@
 
 #include "lib.h"
 #include "str.h"
+#include "backtrace-string.h"
 #include "write-full.h"
 #include "fd-close-on-exec.h"
 #include "printf-upper-bound.h"
@@ -120,7 +121,11 @@
 static void __attr_format__(1, 0)
 default_panic_handler(const char *format, va_list args)
 {
+	const char *backtrace;
+
 	(void)default_handler("Panic: ", log_fd, format, args);
+	if (backtrace_get(&backtrace) == 0)
+		i_error("Backtrace: %s", backtrace);
 	abort();
 }
 
@@ -290,8 +295,12 @@
 
 void i_syslog_panic_handler(const char *fmt, va_list args)
 {
+	const char *backtrace;
+
 	(void)syslog_handler(LOG_CRIT, fmt, args);
-        abort();
+	if (backtrace_get(&backtrace) == 0)
+		i_error("Backtrace: %s", backtrace);
+	abort();
 }
 
 void i_syslog_fatal_handler(int status, const char *fmt, va_list args)
@@ -384,7 +393,11 @@
 static void __attr_noreturn__ __attr_format__(1, 0)
 i_internal_panic_handler(const char *fmt, va_list args)
 {
+	const char *backtrace;
+
 	(void)internal_handler('F', fmt, args);
+	if (backtrace_get(&backtrace) == 0)
+		i_error("Backtrace: %s", backtrace);
         abort();
 }
 



More information about the dovecot-cvs mailing list