* gcov vs. multiple objects derived from the same source
@ 2008-03-05 9:08 Bernd Jendrissek
2008-03-07 1:15 ` Holger Blasum
0 siblings, 1 reply; 2+ messages in thread
From: Bernd Jendrissek @ 2008-03-05 9:08 UTC (permalink / raw)
To: gcc-help
[Please keep me Cc'ed as I am not subscribed.]
At work I have a bunch of source files that want to be compiled with
different CPPFLAGS. Since we now use automake, this implies that if
foo.c gets compiled into ${bindir}/bar, we get a file bar-foo.o, and
the same for the siblings of bar.
I'm worried that when I do gcov *.o, gcov might not notice that two
objects are derived from the same file, and thus the coverage notes
might reflect coverage only of a subset of the use cases - those that
exercise foo.c through ${bindir}/bar but not those that exercise it
through ${bindir}/baz.
Are there any guarantees (or specific lack thereof) about gcov's
behaviour under these circumstances?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gcov vs. multiple objects derived from the same source
2008-03-05 9:08 gcov vs. multiple objects derived from the same source Bernd Jendrissek
@ 2008-03-07 1:15 ` Holger Blasum
0 siblings, 0 replies; 2+ messages in thread
From: Holger Blasum @ 2008-03-07 1:15 UTC (permalink / raw)
To: Bernd Jendrissek; +Cc: gcc-help
Hello Bernd,
On Wed, Mar 05, 2008 at 11:08:04AM +0200, Bernd Jendrissek wrote:
> I'm worried that when I do gcov *.o, gcov might not notice that two
> objects are derived from the same file, and thus the coverage notes
> might reflect coverage only of a subset of the use cases - those that
> exercise foo.c through ${bindir}/bar but not those that exercise it
> through ${bindir}/baz.
> Are there any guarantees (or specific lack thereof) about gcov's
> behaviour under these circumstances?
"gcov bar.o baz.o" ->
gcov bar.o reads bar.gcno and bar.gcda, then writes output into foo.c.gcov
gcov baz.o reads baz.gcno and baz.gcda, then writes output into foo.c.gcov
(overwriting the first foo.c) (tested with gcc-3.4.4)
(Although it is built in into the gnu coverage framework to be able to
add up counts this from different runs of the *same* executable, this
is done at the gcda level and not at the foo.c.gcov level, possibly with
the intention to keep things simple.)
Solution: use lcov from the linux test project that has adding
up functionality at the *.c.gcov level (internally it just uses
the same gcov framework)
(Let's assume that bar contains bar.o and baz contain baz.o)
lcov --zerocounters
./bar
lcov --capture --output-file barbaz.info
./baz
lcov --capture --output-file barbaz.info
genhtml barbaz.info
HTH,
--
Holger Blasum AT www.sysgo.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-07 1:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 9:08 gcov vs. multiple objects derived from the same source Bernd Jendrissek
2008-03-07 1:15 ` Holger Blasum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).