public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Holger Blasum <hbl@sysgo.com>
To: Bernd Jendrissek <bernd.jendrissek@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: gcov vs. multiple objects derived from the same source
Date: Fri, 07 Mar 2008 01:15:00 -0000	[thread overview]
Message-ID: <20080307011445.GA13489@koretsu> (raw)
In-Reply-To: <b39469680803050108m3355f7fak51ea46d11bdda202@mail.gmail.com>

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

      reply	other threads:[~2008-03-07  1:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05  9:08 Bernd Jendrissek
2008-03-07  1:15 ` Holger Blasum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080307011445.GA13489@koretsu \
    --to=hbl@sysgo.com \
    --cc=bernd.jendrissek@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).