[master] 744c5ad Fix two issues in our backtrace code:

Poul-Henning Kamp phk at varnish-cache.org
Mon Nov 4 12:29:12 CET 2013


commit 744c5ad3e02b3a440be0e0e2b009b369e5d3172f
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/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index e3368df..fd64b2f 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -237,7 +237,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);
 }
 
@@ -249,7 +251,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