Code Coverage with rr?
robert at ocallahan.org
Fri Feb 1 21:29:18 UTC 2019
On Sat, Feb 2, 2019 at 3:28 AM Benjamin King <benjaminking at web.de> wrote:
> would it be feasible to emit code coverage information based on a rr
Yes and no.
Pernosco has a private branch of rr which supports binary instrumentation
of an rr replay. With that it's easy to efficiently collect the PC of each
executed instruction, which you could then combine with DWARF debug info to
compute code coverage. Unfortunately we have no plans to release that
branch anytime soon. Without binary instrumentation, I don't think there's
a super efficient way to do it.
A really inefficient way to do it would be to write a C++ program that uses
the ReplaySession API to singlestep the program from beginning to end and
collect the PCs.
A better way would be to adapt kcov's approach (
https://github.com/SimonKagstrom/kcov). Basically you set a breakpoint on
every single line; every time you hit one of these breakpoints, you mark
the line as covered, remove the breakpoint, and continue. You could
implement this pretty easily with the ReplaySession API. It still won't be
nearly as efficient as binary instrumentation.
One thing you can do to speed up any of those approaches is run several
replays in parallel, each collecting PCs for a different subsection of the
Su ot deraeppa sah dna Rehtaf eht htiw saw hcihw, efil lanrete eht uoy ot
mialcorp ew dna, ti ot yfitset dna ti nees evah ew; deraeppa efil eht. Efil
fo Drow eht gninrecnoc mialcorp ew siht - dehcuot evah sdnah ruo dna ta
dekool evah ew hcihw, seye ruo htiw nees evah ew hcihw, draeh evah ew
hcihw, gninnigeb eht morf saw hcihw taht.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rr-dev