public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Fw: Regarding __gcov_dump and __gcov_reset usage
@ 2021-05-24 11:44 Gejoe Daniel
  2021-05-24 14:02 ` Martin Liška
  0 siblings, 1 reply; 3+ messages in thread
From: Gejoe Daniel @ 2021-05-24 11:44 UTC (permalink / raw)
  To: gcc, gcc-help

[-- Attachment #1: Type: text/plain, Size: 1839 bytes --]

Adding gcc mailing list for the clarification.

Thank you team ! 

From: "Gejoe Daniel"<gejoed@rediffmail.com>
Sent: Mon, 24 May 2021 15:02:12
To: "gcc-help@gcc.gnu.org"<gcc-help@gcc.gnu.org>
Subject: Re: Regarding __gcov_dump and __gcov_reset usage

Hi team,

Any info/reply ?

Thanking you in advance,
Gejoe


From: "Gejoe Daniel"<gejoed@rediffmail.com>
Sent: Sun, 16 May 2021 17:37:46
To: <gcc-help@gcc.gnu.org>
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() :
https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html#Gcov-and-Optimization

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.

Thanks,
Gejoe
 

[-- Attachment #2: sample-prog.c --]
[-- Type: application/octet-stream, Size: 535 bytes --]

// sample-prog.c
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>

extern void __gcov_reset(void);
extern void __gcov_flush(void);
extern void __gcov_dump( void);

int main()
{
    unsigned char c;
    int result;
    unsigned char data[]={127,49,255,255};
	c = '5';

	do {
   
		c = getchar();
		result = isalnum(c);
		printf("When %c is passed, return value is %d\n", c, result);

		if(c == 'g')
			__gcov_dump();
		else if(c == 'r')
			__gcov_reset();
		
	}while(c != 'c');
    
	return 0;
}

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

* Re: Fw: Regarding __gcov_dump and __gcov_reset usage
  2021-05-24 11:44 Fw: Regarding __gcov_dump and __gcov_reset usage Gejoe Daniel
@ 2021-05-24 14:02 ` Martin Liška
  2021-05-25  7:05   ` Gejoe Daniel
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2021-05-24 14:02 UTC (permalink / raw)
  To: Gejoe Daniel, gcc, gcc-help

On 5/24/21 1:44 PM, Gejoe Daniel via Gcc wrote:
> Adding gcc mailing list for the clarification.
> 
> Thank you team !&nbsp;
> 
> From: &quot;Gejoe Daniel&quot;&lt;gejoed@rediffmail.com&gt;
> Sent: Mon, 24 May 2021 15:02:12
> To: &quot;gcc-help@gcc.gnu.org&quot;&lt;gcc-help@gcc.gnu.org&gt;
> Subject: Re: Regarding __gcov_dump and __gcov_reset usage
> 
> Hi team,
> 
> Any info/reply ?
> 
> Thanking you in advance,
> Gejoe
> 
> 
> From: &quot;Gejoe Daniel&quot;&lt;gejoed@rediffmail.com&gt;
> Sent: Sun, 16 May 2021 17:37:46
> To: &lt;gcc-help@gcc.gnu.org&gt;
> Subject: Regarding __gcov_dump and __gcov_reset usage
> 
> Hi team,
> 
> I did go through the online manual of gcc gcov&nbsp; on __gcov_dump() and __gcov_reset() :
> https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html#Gcov-and-Optimization
> 
> I tried out using the functions in a sample program (sample-prog.c) that is attached here.
> 
> The steps followed were :
> 
> (1)&nbsp; gcc -fprofile-arcs -ftest-coverage sample-prog.c&nbsp;
> (2)&nbsp; ./a.out
> (3)&nbsp;&nbsp;gcov sample-prog.c
> 
> While running a.out, when I give character &#39;g&#39;, 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 &#39;g&#39; character during the a.out run) doesn&#39;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&nbsp; that, __gcov_reset() also doesn&#39;t appear to work. I tried giving the character &#39;r&#39; during the run of the program but couldn&#39;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.
> 
> Thanks,
> Gejoe
> &nbsp;
> 

Hello.

Can you please create bug at: https://gcc.gnu.org/bugzilla/
Please upload there a test-case and series of commands executed and the expected result.

Thank you,
Martin

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

* Re: Regarding __gcov_dump and __gcov_reset usage
  2021-05-24 14:02 ` Martin Liška
@ 2021-05-25  7:05   ` Gejoe Daniel
  0 siblings, 0 replies; 3+ messages in thread
From: Gejoe Daniel @ 2021-05-25  7:05 UTC (permalink / raw)
  To: Martin Li  ka; +Cc: gcc, gcc-help

Hi Martin,

The bug is created :&nbsp;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100751
&nbsp;Let me know if any more info is required.

Thanks,
Gejoe

From: Martin Li ka &lt;mliska@suse.cz&gt;
Sent: Mon, 24 May 2021 19:32:10
To: Gejoe Daniel &lt;gejoed@rediffmail.com&gt;, gcc@gcc.gnu.org, gcc-help@gcc.gnu.org
Subject: Re: Regarding __gcov_dump and __gcov_reset usage

On 5/24/21 1:44 PM, Gejoe Daniel via Gcc wrote:
&gt; Adding gcc mailing list for the clarification.
&gt;
&gt; Thank you team !&amp;nbsp;
&gt;
&gt; From: &amp;quot;Gejoe Daniel&amp;quot;&amp;lt;gejoed@rediffmail.com&gt;;
&gt; Sent: Mon, 24 May 2021 15:02:12
&gt; To: &amp;quot;gcc-help@gcc.gnu.org&quot;;&amp;lt;gcc-help@gcc.gnu.org&gt;;
&gt; Subject: Re: Regarding __gcov_dump and __gcov_reset usage
&gt;
&gt; Hi team,
&gt;
&gt; Any info/reply ?
&gt;
&gt; Thanking you in advance,
&gt; Gejoe
&gt;
&gt;
&gt; From: &amp;quot;Gejoe Daniel&amp;quot;&amp;lt;gejoed@rediffmail.com&gt;;
&gt; Sent: Sun, 16 May 2021 17:37:46
&gt; To: &amp;lt;gcc-help@gcc.gnu.org&gt;;
&gt; Subject: Regarding __gcov_dump and __gcov_reset usage
&gt;
&gt; Hi team,
&gt;
&gt; I did go through the online manual of gcc gcov&amp;nbsp; on __gcov_dump() and __gcov_reset() :
&gt; https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html#Gcov-and-Optimization
&gt;
&gt; I tried out using the functions in a sample program (sample-prog.c) that is attached here.
&gt;
&gt; The steps followed were :
&gt;
&gt; (1)&amp;nbsp; gcc -fprofile-arcs -ftest-coverage sample-prog.c&amp;nbsp;
&gt; (2)&amp;nbsp; ./a.out
&gt; (3)&amp;nbsp;&amp;nbsp;gcov sample-prog.c
&gt;
&gt; While running a.out, when I give character &amp;#39;g&amp;#39;, the __gcov_dump() must be invoked.
&gt; What I could observe is that first time __gcov_dump() is invoked ,&nbsp;the sample-prog.gcda file gets created.
&gt; For the second time and then onwards, __gcov_dump() invocation (by giving &amp;#39;g&amp;#39; character during the a.out run) doesn&amp;#39;t happen.
&gt; 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().
&gt;
&gt; Another thing is&amp;nbsp; that, __gcov_reset() also doesn&amp;#39;t appear to work. I tried giving the character &amp;#39;r&amp;#39; during the run of the program but couldn&amp;#39;t see the counters getting reset to 0 in the sample-prog.gcov file. The previous values of lines covered were there.
&gt;
&gt; Let me know if my approach is correct or if I miss any information here.
&gt;
&gt; Thanks,
&gt; Gejoe
&gt; &amp;nbsp;
&gt;

Hello.

Can you please create bug at: https://gcc.gnu.org/bugzilla/
Please upload there a test-case and series of commands executed and the expected result.

Thank you,
Martin

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

end of thread, other threads:[~2021-05-25  7:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 11:44 Fw: Regarding __gcov_dump and __gcov_reset usage Gejoe Daniel
2021-05-24 14:02 ` Martin Liška
2021-05-25  7:05   ` Gejoe Daniel

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