public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Getting gcov's output when the program is killed
@ 2010-02-26 15:26 Ludovic Courtès
  2010-02-26 17:52 ` Cedric Roux
  2010-02-27  5:58 ` Ian Lance Taylor
  0 siblings, 2 replies; 3+ messages in thread
From: Ludovic Courtès @ 2010-02-26 15:26 UTC (permalink / raw)
  To: gcc-help

Hello,

I’m doing test coverage on a daemon.  The daemon is tested by a script
that launches it and eventually terminates it with kill(1).  However,
the corresponding gcda files are not updated with actual coverage data.

How can gcov be told to flush its coverage data to disk when the program
is killed?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Getting gcov's output when the program is killed
  2010-02-26 15:26 Getting gcov's output when the program is killed Ludovic Courtès
@ 2010-02-26 17:52 ` Cedric Roux
  2010-02-27  5:58 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Cedric Roux @ 2010-02-26 17:52 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: gcc-help

Ludovic Courtès wrote:
> Hello,
> 
> I’m doing test coverage on a daemon.  The daemon is tested by a script
> that launches it and eventually terminates it with kill(1).  However,
> the corresponding gcda files are not updated with actual coverage data.
> 
> How can gcov be told to flush its coverage data to disk when the program
> is killed?
> 
> Thanks,
> Ludo’.

maybe you can modify slightly your deamon, catch the signal
and do a "clean" exit by calling "exit" in the signal handler
or something?
And have a conditional in your code to include/exclude that
behavior depending if you compile with coverage or not.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Getting gcov's output when the program is killed
  2010-02-26 15:26 Getting gcov's output when the program is killed Ludovic Courtès
  2010-02-26 17:52 ` Cedric Roux
@ 2010-02-27  5:58 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2010-02-27  5:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: gcc-help

ludo@gnu.org (Ludovic Courtès) writes:

> How can gcov be told to flush its coverage data to disk when the program
> is killed?

If you can catch the signal, call __gcov_flush().  If you can't catch
the signal, you're out of luck.  Well, I suppose you could have the
program call __gcov_flush every so often.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-26 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-26 15:26 Getting gcov's output when the program is killed Ludovic Courtès
2010-02-26 17:52 ` Cedric Roux
2010-02-27  5:58 ` Ian Lance Taylor

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).