From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF52E385B805; Fri, 28 May 2021 05:49:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF52E385B805 From: "gejoed at rediffmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/100751] __gcov_dump and __gcov_reset usage Date: Fri, 28 May 2021 05:49:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 8.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gejoed at rediffmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WORKSFORME X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 May 2021 05:49:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100751 --- Comment #16 from Gejoe --- Created attachment 50881 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50881&action=3Dedit sample-prog.c edited to show __gcov_reset call. The steps used for compiling and running the attached .c file are as follow= s: gcc -v -save-temps -fprofile-arcs -ftest-coverage sample-prog.c=20 gcc -fprofile-arcs -ftest-coverage sample-prog.o ./a.out=20 The output of a.out run is : __gcov_dump() invoked! __gcov_reset() invoked! __gcov_dump() invoked! __gcov_reset() invoked! $ gcov sample-prog.c sample-prog.c:source file is newer than notes file 'sample-prog.gcno' (the message is displayed only once per source file) File 'sample-prog.c' Lines executed:83.33% of 18 Creating 'sample-prog.c.gcov' $ cat sample-prog.c.gcov -: 0:Source:sample-prog.c -: 0:Graph:sample-prog.gcno -: 0:Data:sample-prog.gcda -: 0:Runs:2 -: 0:Programs:1 -: 0:Source is newer than graph -: 1:#include -: 2:#include -: 3:#include -: 4: -: 5:extern void __gcov_reset(void); -: 6:extern void __gcov_flush(void); -: 7:extern void __gcov_dump( void); -: 8: 2: 9:int main() -: 10:{ -: 11: unsigned char c; 2: 12: int count=3D0; 2: 13: c =3D 'g'; -: 14: -: 15: do { -: 16:=20=20=20 -: 17: if(c =3D=3D 'g'){ -: 18: __gcov_dump(); 20: 19: printf("__gcov_dump() invoked!\n"); 4: 20: c =3D 'r'; #####: 21: } #####: 22: else if(c =3D=3D 'r'){ -: 23: __gcov_reset(); 16: 24: printf("__gcov_reset() invoked!\n"); #####: 25: c =3D 'f'; 4: 26: } 4: 27: if(count =3D=3D 2) -: 28: c =3D 'g'; 20: 29: else if (count > 10) 2: 30: c =3D 'e'; 18: 31: count++; 2: 32: }while(c !=3D 'e'); 20: 33:=20=20=20=20 20: 34: return 0; -: 35:}=