static void pan_req(const struct req *req) { const char *stp; VSB_printf(pan_vsp, "req = %p {\n", req); VSB_printf(pan_vsp, " sp = %p, vxid = %u,", req->sp, VXID(req->vsl->wid)); switch (req->req_step) { #define REQ_STEP(l, u, arg) case R_STP_##u: stp = "R_STP_" #u; break; #include "tbl/steps.h" #undef REQ_STEP default: stp = NULL; } if (stp != NULL) VSB_printf(pan_vsp, " step = %s,\n", stp); else VSB_printf(pan_vsp, " step = 0x%x,\n", req->req_step); VSB_printf(pan_vsp, " req_body = %s,\n", reqbody_status_2str(req->req_body_status)); if (req->err_code) VSB_printf(pan_vsp, " err_code = %d, err_reason = %s,\n", req->err_code, req->err_reason ? req->err_reason : "(null)"); VSB_printf(pan_vsp, " restarts = %d, esi_level = %d\n", req->restarts, req->esi_level); if (req->sp != NULL) pan_sess(req->sp); if (req->wrk != NULL) pan_wrk(req->wrk); pan_ws(req->ws, 2); pan_http("req", req->http, 2); if (req->resp->ws != NULL) pan_http("resp", req->resp, 2); if (VALID_OBJ(req->vcl, VCL_CONF_MAGIC)) pan_vcl(req->vcl); if (req->objcore != NULL) { pan_objcore("REQ", req->objcore); if (req->objcore->busyobj != NULL) pan_busyobj(req->objcore->busyobj); } VSB_printf(pan_vsp, "},\n"); }
static void pan_req(struct vsb *vsb, const struct req *req) { const char *stp; VSB_printf(vsb, "req = %p {\n", req); VSB_indent(vsb, 2); VSB_printf(vsb, "vxid = %u, ", VXID(req->vsl->wid)); switch (req->req_step) { #define REQ_STEP(l, u, arg) case R_STP_##u: stp = "R_STP_" #u; break; #include "tbl/steps.h" #undef REQ_STEP default: stp = NULL; } if (stp != NULL) VSB_printf(vsb, "step = %s,\n", stp); else VSB_printf(vsb, "step = 0x%x,\n", req->req_step); VSB_printf(vsb, "req_body = %s,\n", reqbody_status_2str(req->req_body_status)); if (req->err_code) VSB_printf(vsb, "err_code = %d, err_reason = %s,\n", req->err_code, req->err_reason ? req->err_reason : "(null)"); VSB_printf(vsb, "restarts = %d, esi_level = %d,\n", req->restarts, req->esi_level); if (req->sp != NULL) pan_sess(vsb, req->sp); if (req->wrk != NULL) pan_wrk(vsb, req->wrk); pan_ws(vsb, req->ws); if (VALID_OBJ(req->htc, HTTP_CONN_MAGIC)) pan_htc(vsb, req->htc); pan_http(vsb, "req", req->http); if (req->resp->ws != NULL) pan_http(vsb, "resp", req->resp); VCL_Panic(vsb, req->vcl); if (req->objcore != NULL) { pan_objcore(vsb, "REQ", req->objcore); if (req->objcore->busyobj != NULL) pan_busyobj(vsb, req->objcore->busyobj); } VSB_printf(vsb, "flags = {\n"); VSB_indent(vsb, 2); #define REQ_FLAG(l, r, w, d) if(req->l) VSB_printf(vsb, #l ",\n"); #include "tbl/req_flags.h" #undef REQ_FLAG VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); }
static void pan_ic(const char *func, const char *file, int line, const char *cond, int err, int xxx) { const char *q; const struct sess *sp; AZ(pthread_mutex_lock(&panicstr_mtx)); /* Won't be released, we're going to die anyway */ switch(xxx) { case 3: VSB_printf(vsp, "Wrong turn at %s:%d:\n%s\n", file, line, cond); break; case 2: VSB_printf(vsp, "Panic from VCL:\n %s\n", cond); break; case 1: VSB_printf(vsp, "Missing errorhandling code in %s(), %s line %d:\n" " Condition(%s) not true.", func, file, line, cond); break; default: case 0: VSB_printf(vsp, "Assert error in %s(), %s line %d:\n" " Condition(%s) not true.\n", func, file, line, cond); break; } if (err) VSB_printf(vsp, "errno = %d (%s)\n", err, strerror(err)); q = THR_GetName(); if (q != NULL) VSB_printf(vsp, "thread = (%s)\n", q); VSB_printf(vsp, "ident = %s,%s\n", VSB_data(vident) + 1, WAIT_GetName()); pan_backtrace(); if (!(cache_param->diag_bitmap & 0x2000)) { sp = THR_GetSession(); if (sp != NULL) pan_sess(sp); } VSB_printf(vsp, "\n"); VSB_bcat(vsp, "", 1); /* NUL termination */ if (cache_param->diag_bitmap & 0x4000) (void)fputs(VSM_head->panicstr, stderr); #ifdef HAVE_ABORT2 if (cache_param->diag_bitmap & 0x8000) { void *arg[1]; char *p; for (p = VSM_head->panicstr; *p; p++) if (*p == '\n') *p = ' '; arg[0] = VSM_head->panicstr; abort2(VSM_head->panicstr, 1, arg); } #endif if (cache_param->diag_bitmap & 0x1000) exit(4); else abort(); }