[master] 5a202b8f9 Add back libvmod debug when flint'ing varnishd

Nils Goroll nils.goroll at uplex.de
Thu Jan 7 17:23:06 UTC 2021


commit 5a202b8f9a818df2f48170d90479eb0047e88301
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Jan 7 17:45:30 2021 +0100

    Add back libvmod debug when flint'ing varnishd
    
    My intention behind c021fbca5133f6282ff13092030b1e35fc1bc5e1 was that
    flexelint complains about symbols being defined multiple times.
    
    Yet when we omit all vmods, we end up with lots of 759 (could be moved
    from header to module).
    
    So add back vmod_debug and have that refer more of the API.

diff --git a/bin/varnishd/flint.sh b/bin/varnishd/flint.sh
index 05ade4472..fe6311907 100755
--- a/bin/varnishd/flint.sh
+++ b/bin/varnishd/flint.sh
@@ -19,4 +19,8 @@ FLOPS='
 	../../lib/libvarnish/*.c
 	../../lib/libvcc/flint.lnt
 	../../lib/libvcc/*.c
+	../../vmod/flint.lnt
+	../../vmod/vcc_debug_if.c
+	../../vmod/vmod_debug*.c
+	../../vmod/VSC_debug*.c
 ' ../../tools/flint_skel.sh
diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c
index 7c50561f5..0e01ee3d3 100644
--- a/vmod/vmod_debug.c
+++ b/vmod/vmod_debug.c
@@ -505,8 +505,15 @@ event_warm(VRT_CTX, const struct vmod_priv *priv)
 {
 	struct priv_vcl *priv_vcl;
 	char buf[32];
+	const char *p[2];
+	struct strands msg[1];
 
-	VSL(SLT_Debug, 0, "%s: VCL_EVENT_WARM", VCL_Name(ctx->vcl));
+	// Using VSLs for coverage
+	msg->n = 2;
+	msg->p = p;
+	p[0] = VCL_Name(ctx->vcl);
+	p[1] = ": VCL_EVENT_WARM";
+	VSLs(SLT_Debug, 0, msg);
 
 	AN(ctx->msg);
 	if (cache_param->max_esi_depth == 42) {
@@ -805,6 +812,20 @@ xyzzy_sethdr(VRT_CTX, VCL_HEADER hs, VCL_STRANDS s)
 	}
 }
 
+// coverage
+static void
+mylog(struct vsl_log *vsl, enum VSL_tag_e tag,  const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	if (vsl != NULL)
+		VSLbv(vsl, tag, fmt, ap);
+	else
+		VSLv(tag, 0, fmt, ap);
+	va_end(ap);
+}
+
 VCL_DURATION
 xyzzy_priv_perf(VRT_CTX, VCL_INT size, VCL_INT rounds)
 {
@@ -838,7 +859,7 @@ xyzzy_priv_perf(VRT_CTX, VCL_INT size, VCL_INT rounds)
 
 	d = (t1 - t0) * 1e9 / ((double)size * (double)rounds);
 
-	VSLb(ctx->vsl, SLT_Debug,
+	mylog(ctx->vsl, SLT_Debug,
 	     "perf size %jd rounds %jd time %.1fns check %jd",
 	     (intmax_t)size, (intmax_t)rounds, d, (uintmax_t)check);
 
@@ -850,6 +871,7 @@ xyzzy_return_strands(VRT_CTX, VCL_STRANDS strand)
 {
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	VSLbs(ctx->vsl, SLT_Debug, strand);
 	return (strand);
 }
 


More information about the varnish-commit mailing list