Bug 80435 - Expose __gcov_flush to allow developers to dump coverage numbers on demand
Summary: Expose __gcov_flush to allow developers to dump coverage numbers on demand
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: gcov-profile (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Martin Liška
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-15 03:01 UTC by Ngie Cooper
Modified: 2017-05-29 09:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 7.0.1
Known to fail: 5.4.0, 6.3.0
Last reconfirmed: 2017-04-15 00:00:00


Attachments
Untested patch (2.08 KB, patch)
2017-04-18 08:46 UTC, Martin Liška
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ngie Cooper 2017-04-15 03:01:37 UTC
If a test program uses _exit in lieu of exit, the end-user must call __gcov_flush. Unfortunately this API isn't currently exposed anywhere, so calling it isn't possible unless someone adds appropriate extern's in program headers.

It would be really nice if this API was exposed so others didn't need to back a __gcov_flush definition in their sources (this seems to be the hack that multiple individuals are using to workaround __gcov_flush not being made public via binutils :(, e.g., https://gcc.gnu.org/ml/gcc-help/2015-06/msg00135.html ).

The companion bug I filed for this on the LLVM side can be found here: http://bugs.llvm.org/show_bug.cgi?id=32555 .
Comment 1 Martin Liška 2017-04-15 07:28:22 UTC
Thanks for report, I'll take a look.
Comment 2 Martin Liška 2017-04-18 08:46:06 UTC
Created attachment 41211 [details]
Untested patch
Comment 3 Jan Hubicka 2017-04-18 15:01:26 UTC
The patch is preapproved (for release branch, too, assuming that RMs agree). Thanks!
Comment 4 Martin Liška 2017-04-19 08:09:16 UTC
Author: marxin
Date: Wed Apr 19 08:08:44 2017
New Revision: 246990

URL: https://gcc.gnu.org/viewcvs?rev=246990&root=gcc&view=rev
Log:
Introduce gcov.h header file (PR gcov-profile/80435).

2017-04-19  Martin Liska  <mliska@suse.cz>

	PR gcov-profile/80435
	* Makefile.in: Install gcov.h.
	* gcov.h: New file.
	* libgcov.h: Use the header and make __gcov_flush publicly
	visible.

Added:
    trunk/libgcc/gcov.h
Modified:
    trunk/libgcc/ChangeLog
    trunk/libgcc/Makefile.in
    trunk/libgcc/libgcov.h
Comment 5 Martin Liška 2017-04-19 08:13:15 UTC
Fixed on trunk, queued for active branches.
Comment 6 Martin Liška 2017-05-29 09:22:34 UTC
Fixed.