Commit 96d83746 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add WRONG(expl) macro for panicing from places we just shouldn't get to.

Dump the handling value from the last VCL method on panic



git-svn-id: http://www.varnish-cache.org/svn/trunk@3057 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent c229232a
......@@ -194,7 +194,7 @@ pan_wrk(const struct worker *wrk)
static void
pan_sess(const struct sess *sp)
{
const char *stp;
const char *stp, *hand;
vsb_printf(vsp, "sp = %p {\n", sp);
vsb_printf(vsp,
......@@ -207,6 +207,16 @@ pan_sess(const struct sess *sp)
#define STEP(l, u) case STP_##u: stp = "STP_" #u; break;
#include "steps.h"
#undef STEP
/*lint -restore */
default: stp = NULL;
}
switch (sp->handling) {
/*lint -save -e525 */
#define VCL_RET_MAC(l, u, b, v) case VCL_RET_##u: hand = #u; break;
#define VCL_RET_MAC_E(l, u, b, v) case VCL_RET_##u: hand = #u; break;
#include "vcl_returns.h"
#undef VCL_RET_MAC
#undef VCL_RET_MAC_E
/*lint -restore */
default: stp = NULL;
}
......@@ -214,6 +224,10 @@ pan_sess(const struct sess *sp)
vsb_printf(vsp, " step = %s,\n", stp);
else
vsb_printf(vsp, " step = 0x%x,\n", sp->step);
if (stp != NULL)
vsb_printf(vsp, " handling = %s,\n", hand);
else
vsb_printf(vsp, " handling = 0x%x,\n", sp->handling);
if (sp->err_code)
vsb_printf(vsp,
" err_code = %d, err_reason = %s,\n", sp->err_code,
......@@ -247,6 +261,10 @@ pan_ic(const char *func, const char *file, int line, const char *cond, int err,
const struct sess *sp;
switch(xxx) {
case 3:
vsb_printf(vsp,
"Wrong turn:\n%s\n", cond);
break;
case 2:
vsb_printf(vsp,
"Panic from VCL:\n%s\n", cond);
......
......@@ -98,3 +98,7 @@ do { \
#define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0)
#define XXXAN(foo) do { xxxassert((foo) != 0); } while (0)
#define diagnostic(foo) assert(foo)
#define WRONG(expl) \
do { \
lbv_assert(__func__, __FILE__, __LINE__, expl, errno, 3); \
} while (0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment