GCOV is showing 0 percent code coverage

mandar munagekar mandarmunagekar@gmail.com
Wed Nov 20 20:00:00 GMT 2019


Hi,

We are working on a code coverage tool which requires the gcov to show code
coverage. Right now, it is showing 0 percent for all the files in our
directory. We tried following approaches  -
1. We build the entire db2 source code on gcc8 with export COMPILER=gcc8.
We made sure that gcc8 is used and this runs fine
2. We include flags -fprofile-arcs -ftest-coverage to both compiler and
linker. We then compiled all source code. At this point there are .gcno
files (files needed for gcov) generated appropriately.
3. We run a db2 query for inserting million rows. Technically, it should
run some of the object files for our codes.  This created necessary .gcda
files which are needed by gcov.
4. We analyzed the intermediary files as well through gcov-dumps and see
that some counters are updated.
5. To find the final coverage, when we do gcov <filename>. It reports 0
coverage despite some activity seen in .gcda files.

We tried a lot of options like:
A. running gcc without various levels of optimization
B. changing permissions of source files and intermediary files
C. using gcov_flush with and without explicit signal handlers.
D. Trying with almost all of the suggestions listed in stackoverflow.
E. Matching the compiler gcc and gcov versions.

Are we missing something here? Does anybody faced same issue?



More information about the Gcc-help mailing list