Mailing List Archive

r2303 - trunk/varnish-cache/bin/varnishd
Author: des
Date: 2007-12-18 18:02:39 +0100 (Tue, 18 Dec 2007)
New Revision: 2303

Modified:
trunk/varnish-cache/bin/varnishd/cache_panic.c
Log:
Tweak the panic string, and document how to extract it post-mortem.


Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_panic.c 2007-12-18 17:02:05 UTC (rev 2302)
+++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2007-12-18 17:02:39 UTC (rev 2303)
@@ -37,7 +37,12 @@

#ifndef WITHOUT_ASSERTS

-/* panic string */
+/*
+ * The panic string is constructed in memory, then printed to stderr. It
+ * can be extracted post-mortem from a core dump using gdb:
+ *
+ * (gdb) printf "%s", panicstr
+ */
char panicstr[65536];
static char *pstr = panicstr;

@@ -67,8 +72,9 @@
#define MAX_BYTES (4*16)
#define show(ch) (((ch) > 31 && (ch) < 127) ? (ch) : '.')

+ fp(" %u {\n", st->len);
for (i = 0; i < MAX_BYTES && i < st->len; i += 16) {
- fp(" ");
+ fp(" ");
for (j = 0; j < 16; ++j) {
if (i + j < st->len)
fp("%02x ", st->ptr[i + j]);
@@ -82,7 +88,8 @@
fp("|\n");
}
if (st->len > MAX_BYTES)
- fp(" [%u more]\n", st->len - MAX_BYTES);
+ fp(" [%u more]\n", st->len - MAX_BYTES);
+ fp(" },\n");

#undef show
#undef MAX_BYTES
@@ -115,6 +122,7 @@
fp(" obj = %p {\n", o);
fp(" refcnt = %u, xid = %u,\n", o->refcnt, o->xid);
dump_http(o->http);
+ fp(" len = %u,\n", o->len);
fp(" store = {\n");
VTAILQ_FOREACH(st, &o->store, list) {
dump_storage(st);