gcov/lcov problems with branch coverage and c++
Brian Drummond
brian@shapes.demon.co.uk
Thu Feb 2 18:36:00 GMT 2017
On Thu, 2017-02-02 at 14:59 +0100, Sven Eppler wrote:
> Hello,
> we are using GCOV/LCOV to produce test coverage for our projects.
> Recently we tried to enable branch-coverage additionally.
> But it looks like, this just doesn't yield the results we expected
> fromÂ
> a high level developer view.
>
> Using branch-coverage with C++ blows the report up with branches allÂ
> over the place.
> We suspect (as the searching for the issues indicates) that mostlyÂ
> exception handling code
> creates these "hidden branches". And GCOV/LCOV doesn't seem to skip
> overÂ
> these.
I am also interested in any developments on this.
gcc can also be used as a backend for other compilers : notably, ghdl
compiles VHDL code for simulation, and can be built with gcc, which
provides code coverage (using gcov/lcov) and to some extent, branch
coverage.
(ghdl also builds with two other back ends, but only gcc provides code
coverage)
https://github.com/tgingold/ghdl
But like C++, there are branches all over the place, not all explicit
branches in the VHDL source code.
For example in VHDL, the "signal" is the inter-process communication
mechanism, and thus a simple signal assignment produces branches (for
example, to reschedule processes waiting on the signal).
It would be convenient if there was a way to tag specific branches in
the intermediate Gimple code, as "track" or "ignore, do not track" for
branch coverage.
This ability would also help the C++ compiler, which would mark e.g.
exception-related branches as "ignore, to not track".
Any information on whether this facility already exists, or how to go
about adding it, would be of interest.
-- Brian
>
More information about the Gcc-help
mailing list