Re: Regarding __gcov_dump and __gcov_reset usage

Gejoe Daniel
Mon May 24 09:32:12 GMT 2021

Hi team,

Any info/reply ?

Thanking you in advance,

From: "Gejoe Daniel"<>
Sent: Sun, 16 May 2021 17:37:46
To: <>
Subject: Regarding __gcov_dump and __gcov_reset usage

Hi team,

I did go through the online manual of gcc gcov  on __gcov_dump() and __gcov_reset() :

I tried out using the functions in a sample program (sample-prog.c) that is attached here.

The steps followed were :

(1)  gcc -fprofile-arcs -ftest-coverage sample-prog.c 
(2)  ./a.out
(3)  gcov sample-prog.c

While running a.out, when I give character 'g', the __gcov_dump() must be invoked.
What I could observe is that first time __gcov_dump() is invoked , the sample-prog.gcda file gets created.
For the second time and then onwards, __gcov_dump() invocation (by giving 'g' character during the a.out run) doesn't happen.
This is concluded by looking at the time stamp of sample-prog.gcda file in the same folder. It was still having the same time stamp of first time invocation of __gcov_dump().

Another thing is  that, __gcov_reset() also doesn't appear to work. I tried giving the character 'r' during the run of the program but couldn't see the counters getting reset to 0 in the sample-prog.gcov file. The previous values of lines covered were there.

Let me know if my approach is correct or if I miss any information here.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample-prog.c
Type: application/octet-stream
Size: 535 bytes
Desc: not available
URL: <>

More information about the Gcc-help mailing list