Search code examples
gcovlcov

Generating empty .gcda files


I use gcov for doing code coverage analysis with lcov for generating graphical output of coverage. This works well for code file where atleast some part of object file has been executed. I want to be able to track files which have not been executed at all. I suspect this has to do with .gcda files not being generated for these files. Is there a way to force the generation of .gcda file for all object files irrespective of execution?


Solution

  • The procedure to do this is outlined here:

    http://linux.die.net/man/1/lcov

    Recommended procedure when capturing data for a test case:

    1. create baseline coverage data file

      lcov -c -i -d appdir -o app_base.info

    2. perform test

      appdir/test

    3. create test coverage data file

      lcov -c -d appdir -o app_test.info

    4. combine baseline and test coverage data

      lcov -a app_base.info -a app_test.info -o app_total.info