This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Gcov: Counting lines of source code (untested files) as gcov does
- From: "Fredrik Johansson" <frejo221 at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 17 Jul 2006 16:24:09 +0200
- Subject: Gcov: Counting lines of source code (untested files) as gcov does
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