SimonKagstrom / kcov

Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options
http://simonkagstrom.github.io/kcov/
GNU General Public License v2.0
712 stars 109 forks source link

What's the meaning of the hits number ? #341

Closed czlhs closed 3 years ago

czlhs commented 3 years ago

image for example, the above 6 / 6, 3 / 3, 1 / 1. Does it means the expression count or something else ?

SimonKagstrom commented 3 years ago

It means the number of breakpoints on a particular line. So for example

for (int i = 0; i < 3; i++)

has 3 DWARF entries which maps to that line, and 3/3 means that all of them have been hit. Had it been something like

int v = 5;
[...]
for (int i = v; i < 3; i++)

then probably it would have been 1/3, or 2/3. The compilers sometimes generate confusing results, so it's not always quite easy to determine what generated the DWARF entries (see line 43 for an example).

Bash and Python instead generates a hit count, and merged reports only have a boolean hit/or-not-hit state.

czlhs commented 3 years ago

Thanks, I got it.