[3.0] 64eb4e4 Fix two issues in our backtrace code:

Tollef Fog Heen tfheen at varnish-cache.org
Tue Nov 12 15:07:13 CET 2013


commit 64eb4e4850d675e45007eb8e6bd96b086025b5f1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Nov 4 11:22:36 2013 +0000

    Fix two issues in our backtrace code:
    
    use "nm -an", not "nm -agn" which supresses local symbols.
    
    Let backtrace_symbols() handle anything past _end.

diff --git a/bin/varnishd/varnishd.c b/bin/varnishd/varnishd.c
index 2f88409..36c7af2 100644
--- a/bin/varnishd/varnishd.c
+++ b/bin/varnishd/varnishd.c
@@ -262,7 +262,9 @@ Symbol_Lookup(struct vsb *vsb, void *ptr)
 	}
 	if (s0 == NULL)
 		return (-1);
-	VSB_printf(vsb, "%p: %s+%jx", ptr, s0->n, (uintmax_t)pp - s0->a);
+	if (!strcmp(s0->n, "_end"))
+		return (-1);
+	VSB_printf(vsb, "%p: %s+0x%jx", ptr, s0->n, (uintmax_t)pp - s0->a);
 	return (0);
 }
 
@@ -274,7 +276,7 @@ Symbol_hack(const char *a0)
 	uintptr_t a;
 	struct symbols *s;
 
-	bprintf(buf, "nm -agn %s 2>/dev/null", a0);
+	bprintf(buf, "nm -an %s 2>/dev/null", a0);
 	fi = popen(buf, "r");
 	if (fi == NULL)
 		return;



More information about the varnish-commit mailing list