summaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-12 17:03:26 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-12 17:03:26 +0000
commit69dc3a4e56777340841c915c2e7c03af5c9ca82c (patch)
treed44a3f2425087fa5945a33804b14817a93b703ac /debug.c
parent326a0679e731ab5f2d46ae3b07b9f3f0d378f105 (diff)
downloadrsyslog-69dc3a4e56777340841c915c2e7c03af5c9ca82c.tar.gz
rsyslog-69dc3a4e56777340841c915c2e7c03af5c9ca82c.tar.xz
rsyslog-69dc3a4e56777340841c915c2e7c03af5c9ca82c.zip
- improved diagnostic information for abort cases
- some initial effort for malloc/free debugging support - bugfix: using dynafile actions caused rsyslogd abort
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/debug.c b/debug.c
index b46c17b0..d634b247 100644
--- a/debug.c
+++ b/debug.c
@@ -547,6 +547,21 @@ int dbgCondTimedWait(pthread_cond_t *cond, pthread_mutex_t *pmut, const struct t
/* ------------------------- end mutex tracking code ------------------------- */
+
+/* ------------------------- malloc/free tracking code ------------------------- */
+
+/* wrapper for free() */
+void dbgFree(void *pMem, dbgFuncDB_t *pFuncDB, int ln, int iStackPtr)
+{
+ dbgRecordExecLocation(iStackPtr, ln);
+ dbgprintf("%s:%d:%s: free %p\n", pFuncDB->file,
+ ln, pFuncDB->func, (void*) pMem);
+ free(pMem);
+}
+
+
+/* ------------------------- end malloc/free tracking code ------------------------- */
+
/* ------------------------- thread tracking code ------------------------- */
/* get ptr to call stack - if none exists, create a new stack
@@ -670,17 +685,30 @@ void
sigsegvHdlr(int signum)
{
char *signame;
+ struct sigaction sigAct;
+
+ /* first, restore the default abort handler */
+ memset(&sigAct, 0, sizeof (sigAct));
+ sigemptyset(&sigAct.sa_mask);
+ sigAct.sa_handler = SIG_DFL;
+ sigaction(SIGABRT, &sigAct, NULL);
+ /* then do our actual processing */
if(signum == SIGSEGV) {
signame = " (SIGSEGV)";
+ } else if(signum == SIGABRT) {
+ signame = " (SIGABRT)";
} else {
signame = "";
}
- dbgprintf("\n\n\n\nSignal %d%s occured, execution must be terminated %d.\n\n\n\n", signum, signame, SIGSEGV);
+ dbgprintf("\n\n\n\nSignal %d%s occured, execution must be terminated.\n\n\n\n", signum, signame);
dbgPrintAllDebugInfo();
+ dbgprintf("If the call trace is empty, you may want to ./configure --enable-rtinst\n");
+ dbgprintf("\n\nTo submit bug reports, visit http://www.rsyslog.com/bugs\n\n");
+
fflush(stddbg);
/* and finally abort... */