This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcov/lcov problems with branch coverage and c++
- From: Brian Drummond <brian at shapes dot demon dot co dot uk>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 2 Feb 2017 18:35:46 +0000
- Subject: Re: gcov/lcov problems with branch coverage and c++
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=brian at shapes dot demon dot co dot uk;
- References: <35fa43c6-5275-55ce-a7c7-1b831430e5e1@sveneppler.de>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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
>