[master] e3712a4 Slight improvement to our symbol lookup hack.

Poul-Henning Kamp phk at FreeBSD.org
Thu May 14 22:12:50 CEST 2015


commit e3712a45ed2f6d89fb5b814a8681a1810596c8a1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu May 14 17:54:46 2015 +0000

    Slight improvement to our symbol lookup hack.

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index c5413ad..533ec80 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -233,14 +233,16 @@ Symbol_Lookup(struct vsb *vsb, void *ptr)
 	pp = (uintptr_t)ptr;
 	s0 = NULL;
 	VTAILQ_FOREACH(s, &symbols, list) {
-		if (s->a > pp || s->a + s->l < pp)
+		if (s->a > pp || s->a + s->l <= pp)
 			continue;
 		if (s0 == NULL || s->l < s0->l)
 			s0 = s;
 	}
 	if (s0 == NULL)
 		return (-1);
-	VSB_printf(vsb, "%p: %s+0x%jx", ptr, s0->n, (uintmax_t)pp - s0->a);
+	VSB_printf(vsb, "%p: %s", ptr, s0->n);
+	if ((uintmax_t)pp != s0->a)
+		VSB_printf(vsb, "+0x%jx", (uintmax_t)pp - s0->a);
 	return (0);
 }
 



More information about the varnish-commit mailing list