Gcov: Counting lines of source code (untested files) as gcov does

Fredrik Johansson frejo221@gmail.com
Mon Jul 17 14:32:00 GMT 2006


Hi all!

 I'm currently implementing code coverage analysis in an existing
build system. The code tree the system builds consists of "modules"
where some code (and files) is covered by tests and some are not. To
be able to present statistics "per module" I need to know how many
lines of source code there is in the files that are not tested (and
therefore have no .da file (I, have to, use gcc 3.3.6)). I've tried a
couple of tools but to generate a fair avarage "per module" I need the
tool to count lines as gcov does, which they don't.

 The untested files are compiled with --fprofile-arcs and
-ftest-coverage so they do have .bb and .bbg files (again, I use Gcc
3.3.6) so my thinking is to extract the part of gcov.c that count
source code lines and create my own tool to do this by reading the
bb-file. But I've found that this is a bit "hairy" (is that an
expression in english? ;)) as gcov.c depends on a bunch of other gcc
files. And I suck at c to, by the way.

 Has anyone faced, and solved, this problem before? Perhaps someone
already has created a tools that does what I need? Or does anyone has
any general tips if I go forward with extracting the code from gcov.c?

 Thanks!

 Regards,
 Fredrik Johansson



More information about the Gcc mailing list