summaryrefslogtreecommitdiffstats
path: root/lib/log.c
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-09 16:16:44 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-09 16:16:44 -0700
commit1c170a597e2a7abb15aaf636a046eb9b5fb8fe5a (patch)
treef7ca1dd2a5bf38675861a94ec8b1e5b1d468d0b3 /lib/log.c
parent920a53bfa99ea29725da9e1dbaa6bed2254416ab (diff)
parent16ecb4b5011746b7f597e1e3b783f74c5eb4da40 (diff)
downloadquagga-1c170a597e2a7abb15aaf636a046eb9b5fb8fe5a.tar.bz2
quagga-1c170a597e2a7abb15aaf636a046eb9b5fb8fe5a.tar.xz
Merge branch 'jenner' of 192.168.100.1:git/vyatta-quagga into jenner
Diffstat (limited to 'lib/log.c')
-rw-r--r--lib/log.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/log.c b/lib/log.c
index 407904d5..f7a36851 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -435,10 +435,10 @@ zlog_backtrace_sigsafe(int priority, void *program_counter)
{
#ifdef HAVE_STACK_TRACE
static const char pclabel[] = "Program counter: ";
- void *array[20];
+ void *array[64];
int size;
char buf[100];
- char *s;
+ char *s, **bt = NULL;
#define LOC s,buf+sizeof(buf)-s
#ifdef HAVE_GLIBC_BACKTRACE
@@ -485,20 +485,29 @@ zlog_backtrace_sigsafe(int priority, void *program_counter)
syslog_sigsafe(priority|zlog_default->facility,buf,s-buf);
{
int i;
+#ifdef HAVE_GLIBC_BACKTRACE
+ bt = backtrace_symbols(array, size);
+#endif
/* Just print the function addresses. */
for (i = 0; i < size; i++)
{
s = buf;
- s = str_append(LOC,"[bt ");
- s = num_append(LOC,i);
- s = str_append(LOC,"] 0x");
- s = hex_append(LOC,(u_long)(array[i]));
+ if (bt)
+ s = str_append(LOC, bt[i]);
+ else {
+ s = str_append(LOC,"[bt ");
+ s = num_append(LOC,i);
+ s = str_append(LOC,"] 0x");
+ s = hex_append(LOC,(u_long)(array[i]));
+ }
*s = '\0';
if (priority <= zlog_default->maxlvl[ZLOG_DEST_MONITOR])
vty_log_fixed(buf,s-buf);
if (priority <= zlog_default->maxlvl[ZLOG_DEST_SYSLOG])
syslog_sigsafe(priority|zlog_default->facility,buf,s-buf);
}
+ if (bt)
+ free(bt);
}
}
#undef DUMP