GCOV take 2 preview

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Oct 13 10:06:36 UTC 2026


I gave up fixing our current code-coverage setup:  Too much have
shifted under our feet since that was written.

Instead I started over with LLVM's coverage support, and I now
have the first preliminary output:

	https://phk.freebsd.dk/misc/gcov2/

The Vtest2 and Vmod numbers look suspiciously low, but dont panic
that, until I have had a chance to make sure everything is counted.

LLVM's coverage support counts differently than GCC's coverage
support, so the numbers have shifted and changed in and between
files, but I trust both to basically get it right - just differently.

Sparklines are still TBD.  When I see what the jump looks like,
I may decide to restart the sparkline history.

The bad news is that I need LLVM patches to run this.

Somebody hacked "continuous coverage" into LLVM, which is just
a strange way to say the counters are mmap(2)'ed so they also
saved when processes die in interesting ways.

That is only supported on Apple, because it depends on a
a weird linker option only they have, and to be honest,
because whoever did it, didn't give shit about anybody else.

I managed to come up with a small, and circumstances considered,
quite elegant patch for FreeBSD[1], but I have no idea if that
will ever be upstreamed to FreeBSD, much less LLVM.

So to run the "new" gcov, I need a jail or VM with a patched
FreeBSD source tree, which is a bit of a bother.

Poul-Henning

[1] See:

https://lists.freebsd.org/archives/freebsd-current/2026-October/010937.html

The patch almost certainly also works in Linux, but it may be necessary
to get rid of a lot of Linux specific code in that area first.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.


More information about the vinyl-dev mailing list