[master] 8dfa782 Dump loaded VMODs and related details under panic

Federico G. Schwindt fgsch at lodoss.net
Fri Feb 10 03:47:05 CET 2017


commit 8dfa782a5901279f73b19d9d055f26b3250ec8b5
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Fri Feb 10 02:37:40 2017 +0000

    Dump loaded VMODs and related details under panic

diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 8338490..216fdff 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -398,6 +398,7 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
 	if (bo->stale_oc)
 		pan_objcore(vsb, "ims", bo->stale_oc);
 	VCL_Panic(vsb, bo->vcl);
+	VMOD_Panic(vsb);
 	VSB_indent(vsb, -2);
 	VSB_printf(vsb, "},\n");
 }
@@ -462,6 +463,7 @@ pan_req(struct vsb *vsb, const struct req *req)
 		pan_http(vsb, "resp", req->resp);
 
 	VCL_Panic(vsb, req->vcl);
+	VMOD_Panic(vsb);
 
 	if (req->body_oc != NULL)
 		pan_objcore(vsb, "BODY", req->body_oc);
@@ -622,7 +624,8 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
 	if (q != NULL)
 		VSB_printf(pan_vsb, "thread = (%s)\n", q);
 
-	VSB_printf(pan_vsb, "version = %s\n", VCS_version);
+	VSB_printf(pan_vsb, "version = %s, vrt api = %d.%d\n",
+	    VCS_version, VRT_MAJOR_VERSION, VRT_MINOR_VERSION);
 	VSB_printf(pan_vsb, "ident = %s,%s\n",
 	    VSB_data(vident) + 1, Waiter_GetName());
 	VSB_printf(pan_vsb, "now = %f (mono), %f (real)\n",
diff --git a/bin/varnishd/cache/cache_priv.h b/bin/varnishd/cache/cache_priv.h
index 460d01e..dd88025 100644
--- a/bin/varnishd/cache/cache_priv.h
+++ b/bin/varnishd/cache/cache_priv.h
@@ -120,6 +120,7 @@ void VRTPRIV_dynamic_kill(struct vrt_privs *privs, uintptr_t id);
 
 /* cache_vrt_vmod.c */
 void VMOD_Init(void);
+void VMOD_Panic(struct vsb *);
 
 /* http1/cache_http1_pipe.c */
 void V1P_Init(void);
diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index f64cb33..05bd49e 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -61,6 +61,9 @@ struct vmod {
 	void			*hdl;
 	const void		*funcs;
 	int			funclen;
+	const char		*abi;
+	int			vrt_major;
+	int			vrt_minor;
 };
 
 static VTAILQ_HEAD(,vmod)	vmods = VTAILQ_HEAD_INITIALIZER(vmods);
@@ -179,6 +182,9 @@ VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, void *ptr, int len, const char *nm,
 
 		v->funclen = d->func_len;
 		v->funcs = d->func;
+		v->abi = d->abi;
+		v->vrt_major = d->vrt_major;
+		v->vrt_minor = d->vrt_minor;
 
 		REPLACE(v->nm, nm);
 		REPLACE(v->path, path);
@@ -223,6 +229,20 @@ VRT_Vmod_Fini(struct vmod **hdl)
 	FREE_OBJ(v);
 }
 
+void
+VMOD_Panic(struct vsb *vsb)
+{
+	struct vmod *v;
+
+	VSB_printf(vsb, "vmods = {\n");
+	VSB_indent(vsb, 2);
+	VTAILQ_FOREACH(v, &vmods, list)
+		VSB_printf(vsb, "%s = {%s, %d.%d},\n",
+		    v->nm, v->abi, v->vrt_major, v->vrt_minor);
+	VSB_indent(vsb, -2);
+	VSB_printf(vsb, "},\n");
+}
+
 /*---------------------------------------------------------------------*/
 
 static void



More information about the varnish-commit mailing list