Page MenuHomeFreeBSD

gcov support
ClosedPublic

Authored by mmacy on Feb 19 2019, 10:54 PM.

Details

Summary

add gcov support and export results as files in debugfs

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mmacy created this revision.Feb 19 2019, 10:54 PM
mmacy added a reviewer: ngie.Feb 19 2019, 11:31 PM
ngie added inline comments.Feb 19 2019, 11:36 PM
sys/gnu/gcov/gcc_4_7.c
1 ↗(On Diff #54101)

Color me ignorant... is this code obtained from a GPL project by chance?

sys/gnu/gcov/gcov_subr.c
60 ↗(On Diff #54101)

Is this defined in libkern?

119 ↗(On Diff #54101)

I disagree with this assertion.

If someone is intentionally calling __gcov_flush, it means that they anticipate the coverage information to have been flushed out to disk.

In particular, if the kernel panics and this is treated as a no-op, the coverage data could be corrupted, rendering the data useless.

mmacy added inline comments.Feb 19 2019, 11:39 PM
sys/gnu/gcov/gcc_4_7.c
1 ↗(On Diff #54101)

It's tightly coupled with gcc internals. There's no way around it. And frankly it's not a useful concern as one would never ship a profiling kernel.

sys/gnu/gcov/gcov_subr.c
119 ↗(On Diff #54101)

The data isn't being written synchronously. It's being exported by way of pseudofs for the user to collect. If you care about not losing data, collect after every test. The coverage of a kernel test that panics would be lost when using anything other than battery backed RAM.

This is currently a direct port of what Linux does.

mmacy added inline comments.Feb 19 2019, 11:54 PM
sys/gnu/gcov/gcov_subr.c
60 ↗(On Diff #54101)

No. It's copied from libc. Otherwise I wouldn't add a private copy.

Make sure you have a license header for all new files and $FreeBSD$

hselasky accepted this revision.Feb 20 2019, 8:10 AM
This revision is now accepted and ready to land.Feb 20 2019, 8:10 AM
This revision was automatically updated to reflect the committed changes.