From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EE9553856DED; Fri, 15 Apr 2022 13:55:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE9553856DED From: "esgergn at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/105238] Regression: using -fprofile-dir: gcno files not ccache cachable anymore / gcovr report broken Date: Fri, 15 Apr 2022 13:55:13 +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: 9.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: esgergn at hotmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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, 15 Apr 2022 13:55:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105238 --- Comment #6 from Esger Abbink --- After patching ccache 4.5.1 to understand -fprofile-prefix-map it does cach= e .o and .gcno: $ ccache -z -C $ cd /home/esger/src/application/coverage_test/dir1/source/ && CCACHE_DEBUG= =3D CCACHE_BASEDIR=3D/home/esger/src/application/coverage_test/dir1 ccache /usr/bin/g++-9.4p --coverage -fprofile-prefix-map=3D/home/esger/src/application/coverage_test/dir1=3D. -fdebug-prefix-map=3D/home/esger/src/application/coverage_test/dir1=3D. -c /home/esger/src/application/coverage_test/dir1/source/main.cpp $ ccache -s Summary: Hits: 0 / 1 (0.00 %) Direct: 0 / 1 (0.00 %) Preprocessed: 0 / 1 (0.00 %) Misses: 1 Direct: 1 Preprocessed: 1 Primary storage: Hits: 0 / 2 (0.00 %) Misses: 2 Cache size (GB): 0.00 / 5.00 (0.00 %) Cleanups: 4 $ cd /home/esger/src/application/coverage_test/dir2/source/ && CCACHE_DEBUG= =3D CCACHE_BASEDIR=3D/home/esger/src/application/coverage_test/dir2 ccache /usr/bin/g++-9.4p --coverage -fprofile-prefix-map=3D/home/esger/src/application/coverage_test/dir2=3D. -fdebug-prefix-map=3D/home/esger/src/application/coverage_test/dir2=3D. -c /home/esger/src/application/coverage_test/dir2/source/main.cpp $ ccache -s Summary: Hits: 1 / 2 (50.00 %) Direct: 1 / 2 (50.00 %) Preprocessed: 0 / 1 (0.00 %) Misses: 1 Direct: 1 Preprocessed: 1 Primary storage: Hits: 2 / 4 (50.00 %) Misses: 2 Cache size (GB): 0.00 / 5.00 (0.00 %) Cleanups: 4 Using the cached .o/.gcno also generates a gcda in the correct location: $ cd /home/esger/src/application/coverage_test/dir2/source/ && CCACHE_DEBUG= =3D CCACHE_BASEDIR=3D/home/esger/src/application/coverage_test/dir2 ccache /usr/bin/g++-9.4p --coverage -fprofile-prefix-map=3D/home/esger/src/application/coverage_test/dir2=3D. -fdebug-prefix-map=3D/home/esger/src/application/coverage_test/dir2=3D. mai= n.o -o ../bin/a.out $ cd /home/esger/src/application/coverage_test/dir2 && ./bin/a.out $ ls source/ main.cpp main.gcda main.gcno main.o $ gcovr --html coverage.html . [ coverage report OK ] Though the gcno of source still contains a wrong CWD: $ gcov-dump-9.4p source/main.gcno |more main.gcno:note:magic `gcno':version `A94*' main.gcno:stamp 761679940 main.gcno:cwd: /home/esger/src/application/coverage_test/dir1/source main.gcno: 01000000: 20:FUNCTION ident=3D1826217343, lineno_checksum=3D0x36a9d8e5, cfg_checksum=3D0xc0bbb23e, `_GLOBAL__sub_I__Z= 5funcAi' main.cpp:21:1-21:1, artificial main.gcno: 01410000: 1:BLOCKS 4 blocks main.gcno: 01430000: 3:ARCS 1 arcs main.gcno: 01430000: 5:ARCS 2 arcs main.gcno: 01430000: 3:ARCS 1 arcs main.gcno: 01450000: 9:LINES main.gcno: 01450000: 9:LINES ... Not sure though what (negative) impact that will/could have?=