]> err.no Git - varnish/commitdiff
Add WRONG(expl) macro for panicing from places we just shouldn't get to.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 1 Aug 2008 10:50:36 +0000 (10:50 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 1 Aug 2008 10:50:36 +0000 (10:50 +0000)
Dump the handling value from the last VCL method on panic

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3057 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_panic.c
varnish-cache/include/libvarnish.h

index decc017b2b2b3ce763e7e1b79c1b1afe6a8ed448..fc6dc42cc4bb439cb315ca2e7f0cbe1c04c12b6d 100644 (file)
@@ -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);
index 15acdc6897a079cb7ce082bb8d01eace087af9e7..8f74f839a246d2083ab8b5709812fe72012bc60f 100644 (file)
@@ -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)