gcov not generating .gcda file

Andi Hellmund mail@andihellmund.com
Thu Jun 24 01:31:00 GMT 2010


Hey Herb,

sorry for the late response.

> I do get .gcno files.

Right, these files get generated by the compiler if you specify the 
-ftest-coverage option (or the --coverage option). The *.gcno files will 
the be used to calcuate the program coverage by gcov.

> Is theer some sort of a log file some where that may give me an idea 
> what is happening?

I shortly checked the code of libgcov.a and I could not find any log 
entries. So, if you really want to debug the libgcov.a (which gets 
linked into your app whenever you build with -fprofile-arcs) you would 
apparently have to modify the code of libgcov.a.

But, while playing around with the -fprofile-arcs and -ftest-coverage 
options, I realized that the *.gcda don't necessarily get created in 
your current work directory. The file path for the *.gcda file gets 
included hard-coded as absolute file name into the executable.

For example, taking this sample test program 'test.exe', you could 
display the file paths by using:

# strings test.exe | grep gcda
/home/andi/Development/gcov/test.gcda

I don't want to say that this is the solution for your problem, but 
maybe you looked in the wrong directories?

Unfortunately, I can't find any option which tells gcc to write a 
relative path into the exectuable, but I would say it should be quite 
easy to add a patch for that (assuming this solves your problem)

I hope that helps,
Andi



More information about the Gcc-help mailing list