[master] 60018c5 Strip paths in backtraces.
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jan 28 11:16:06 CET 2015
commit 60018c5add7e6b3b9af27bdef44970179623b5ec
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jan 28 10:15:50 2015 +0000
Strip paths in backtraces.
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 85a0c45..a5c2ce6 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -458,6 +458,8 @@ pan_backtrace(void)
void *array[10];
size_t size;
size_t i;
+ char **strings;
+ char *p;
size = backtrace (array, 10);
if (size == 0)
@@ -466,13 +468,17 @@ pan_backtrace(void)
for (i = 0; i < size; i++) {
VSB_printf (pan_vsp, " ");
if (Symbol_Lookup(pan_vsp, array[i]) < 0) {
- char **strings;
strings = backtrace_symbols(&array[i], 1);
- if (strings != NULL && strings[0] != NULL)
- VSB_printf(pan_vsp,
- "%p: %s", array[i], strings[0]);
- else
+ if (strings == NULL || strings[0] == NULL) {
VSB_printf(pan_vsp, "%p: (?)", array[i]);
+ } else {
+ p = strrchr(strings[0], '/');
+ if (p == NULL)
+ p = strings[0];
+ else
+ p++;
+ VSB_printf(pan_vsp, "%p: %s", array[i], p);
+ }
}
VSB_printf (pan_vsp, "\n");
}
More information about the varnish-commit
mailing list