diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-12 17:03:26 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-12 17:03:26 +0000 |
commit | 69dc3a4e56777340841c915c2e7c03af5c9ca82c (patch) | |
tree | d44a3f2425087fa5945a33804b14817a93b703ac /debug.c | |
parent | 326a0679e731ab5f2d46ae3b07b9f3f0d378f105 (diff) | |
download | rsyslog-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.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -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... */ |