[Bug gcov-profile/105238] Regression: using -fprofile-dir: gcno files not ccache cachable anymore / gcovr report broken
esgergn at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Apr 15 13:55:13 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105238
--- Comment #6 from Esger Abbink <esgergn at hotmail dot com> ---
After patching ccache 4.5.1 to understand -fprofile-prefix-map it does cache .o
and .gcno:
$ ccache -z -C
$ cd /home/esger/src/application/coverage_test/dir1/source/ && CCACHE_DEBUG=
CCACHE_BASEDIR=/home/esger/src/application/coverage_test/dir1 ccache
/usr/bin/g++-9.4p --coverage
-fprofile-prefix-map=/home/esger/src/application/coverage_test/dir1=.
-fdebug-prefix-map=/home/esger/src/application/coverage_test/dir1=. -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=
CCACHE_BASEDIR=/home/esger/src/application/coverage_test/dir2 ccache
/usr/bin/g++-9.4p --coverage
-fprofile-prefix-map=/home/esger/src/application/coverage_test/dir2=.
-fdebug-prefix-map=/home/esger/src/application/coverage_test/dir2=. -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=
CCACHE_BASEDIR=/home/esger/src/application/coverage_test/dir2 ccache
/usr/bin/g++-9.4p --coverage
-fprofile-prefix-map=/home/esger/src/application/coverage_test/dir2=.
-fdebug-prefix-map=/home/esger/src/application/coverage_test/dir2=. main.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=1826217343,
lineno_checksum=0x36a9d8e5, cfg_checksum=0xc0bbb23e, `_GLOBAL__sub_I__Z5funcAi'
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?
More information about the Gcc-bugs
mailing list