Reputation: 6421
I have successfully set up gcov in my project to generate HTML files with code coverage data using lcov
. However, as I often work via SSH with a text console only, I'm looking for a way to generate annotated source files like git-blame
does with the history:
covered source_line();
not covered other_source_line();
Is it possible somehow?
Upvotes: 1
Views: 267
Reputation: 3739
I'm going to assume you are referring to gcovr
when you say gcov
, since gcov
does not output to HTML format. gcovr
does output to HTML though. gcovr
is basically just a wrapper for gcov
.
In order to get the annotated source files, you need to simply use gcov
.
gcov
, by default, annotates source files.
To run with gcov, you just need to compile with -fprofile-arcs -ftest-coverage -fPIC -O0
, and link in the gcov library(-lgcov
).
Then run your program.
Then issue the following command:
gcov main.c
Where main.c
is whatever file you want your annotated analysis on.
After that, you will notice a new file created(main.c.gcov). This is the file you are looking for.
Here's a link on gcov
usage
Upvotes: 2