Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 471
kdt Avatar asked Sep 17 '09 12:09

kdt


People also ask

What can I do with GCOV files?

You can use gcov as a profiling tool to help discover where your optimization efforts will best affect your code. You can also use gcov along with the other profiling tool, gprof, to assess which parts of your code use the greatest amount of computing time. Profiling tools help you analyze your code's performance.


1 Answers

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.

like image 66
F'x Avatar answered Sep 20 '22 04:09

F'x