made backtrace() calls optional to support uClibc

This commit is contained in:
Martin Willi
2006-12-06 13:59:13 +00:00
parent f87e5dd98c
commit e696757c47
3 changed files with 10 additions and 1 deletions
+6 -1
View File
@@ -285,6 +285,7 @@ static void initialize(private_daemon_t *this, bool strict, bool syslog,
*/
void signal_handler(int signal)
{
#ifndef HAVE_BACKTRACE
void *array[20];
size_t size;
char **strings;
@@ -294,13 +295,17 @@ void signal_handler(int signal)
strings = backtrace_symbols(array, size);
DBG1(DBG_DMN, "thread %u received %s. Dumping %d frames from stack:",
signal == SIGSEGV ? "SIGSEGV" : "SIGILL", pthread_self(), size);
pthread_self(), signal == SIGSEGV ? "SIGSEGV" : "SIGILL", size);
for (i = 0; i < size; i++)
{
DBG1(DBG_DMN, " %s", strings[i]);
}
free (strings);
#else /* !HAVE_BACKTRACE */
DBG1(DBG_DMN, "thread %u received %s",
pthread_self(), signal == SIGSEGV ? "SIGSEGV" : "SIGILL");
#endif /* HAVE_BACKTRACE */
DBG1(DBG_DMN, "killing ourself hard after SIGSEGV");
raise(SIGKILL);
}