Can gcc/gcov be made to output coverage stats to a location other than the source folder?

kdt picture kdt · Sep 17, 2009 · Viewed 8.1k times · Source

When using gcc with -fprofile-arcs and -ftest-coverage, when the resulting executable terminates, it tries to create .gcda output files in the same location as the .o files used to compile the executable. This is inconvenient when I'm running on a different machine than the one I built on -- is there any way to change this behaviour?

Answer

F'x picture F'x · Sep 19, 2009

You can use the environment variable GCOV_PREFIX. It's mentionned in the doc under a "cross-profiling" section, which itself is referred to in the documentation for -fprofile-arcs.