I am facing an issue with running gcov on shared library from python script.
I have the following scenario where i build my library:
-
Compile a set of files (file1.c, file2.c) into a statically linked lib(.a). I use ar utility to do this and all the files are compiled using following options:
-static -fprofile-arcs -ftest-coverage -coverage
-
build a .so file using some other files (say file3.c) and the above specified .a file. I use the same options again while compiling and linking.
-
Load the .so in python script and execute.
Issue :
The coverage file that is generated contains code coverage only for file3.c. Files that are part of the .a library are not shown in the coverage report.
Am i missing any option while linking .a here.
Found out the issue.
I was not picking up all the .gcda files for generating the report.
Use -object-directory option to search for all gcda files.
GCOV man page