[master] 523aa3c75 Dont ignore errors when unwinding stacks, the process is far too fickle for that, and misleading information wastes oceans of time.

Poul-Henning Kamp phk at FreeBSD.org
Sun Dec 19 18:14:04 UTC 2021


commit 523aa3c75eed63352fb3f91ee72d57fbc2a31c93
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sun Dec 19 18:00:22 2021 +0000

    Dont ignore errors when unwinding stacks, the process is far too
    fickle for that, and misleading information wastes oceans of time.

diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 9123f1ce8..58933d00a 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -601,12 +601,13 @@ pan_backtrace(struct vsb *vsb)
 	}
 	while (unw_step(&cursor) > 0) {
 		fname[0] = '\0';
-		ip = sp = 0;
-		unw_get_reg(&cursor, UNW_REG_IP, &ip);
-		unw_get_reg(&cursor, UNW_REG_SP, &sp);
-		unw_get_proc_name(&cursor, fname, sizeof(fname), &offp);
-		VSB_printf(vsb, "ip=0x%lx, sp=0x%lx <%s+0x%lx>\n", (long) ip,
-		    (long) sp, fname[0] ? fname : "<unknown>", (long)offp);
+		if (!unw_get_reg(&cursor, UNW_REG_IP, &ip))
+			VSB_printf(vsb, "ip=0x%lx", (long) ip);
+		if (!unw_get_reg(&cursor, UNW_REG_SP, &sp))
+			VSB_printf(vsb, " sp=0x%lx", (long) sp);
+		if (!unw_get_proc_name(&cursor, fname, sizeof(fname), &offp))
+			VSB_printf(vsb, " <%s+0x%lx>\n",
+			    fname[0] ? fname : "<unknown>", (long)offp);
 	}
 
 	VSB_indent(vsb, -2);


More information about the varnish-commit mailing list