From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: "Jørgen Kvalsvik" <jorgen.kvalsvik@woven-planet.global>,
gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Add condition coverage profiling
Date: Mon, 4 Apr 2022 10:14:47 +0200 [thread overview]
Message-ID: <1ee43d5d-9c6c-f55b-e5b1-c82a6ff5f653@embedded-brains.de> (raw)
In-Reply-To: <b53507bf-1c1f-d946-00a5-10143fa647b4@woven-planet.global>
Hello Jørgen,
having support for MC/DC coverage in GCC would be really nice. I tried
out your latest patch on an arm cross-compiler with Newlib (inhibit_libc
is defined). Could you please add the following fix to your patch:
diff --git a/libgcc/libgcov-merge.c b/libgcc/libgcov-merge.c
index 89741f637e1..9e3e8ee5657 100644
--- a/libgcc/libgcov-merge.c
+++ b/libgcc/libgcov-merge.c
@@ -33,6 +33,11 @@ void __gcov_merge_add (gcov_type *counters
__attribute__ ((unused)),
unsigned n_counters __attribute__ ((unused))) {}
#endif
+#ifdef L_gcov_merge_ior
+void __gcov_merge_ior (gcov_type *counters __attribute__ ((unused)),
+ unsigned n_counters __attribute__ ((unused))) {}
+#endif
+
#ifdef L_gcov_merge_topn
void __gcov_merge_topn (gcov_type *counters __attribute__ ((unused)),
unsigned n_counters __attribute__ ((unused))) {}
It seems that support for the new GCOV_TAG_CONDS is missing in gcov-tool
and gcov-dump, see "tag_table" in gcc/gcov-dump.c and libgcc/libgcov-util.c.
On 21/03/2022 12:55, Jørgen Kvalsvik via Gcc-patches wrote:
[...]
> Like Wahlen et al this implementation uses bitsets to store conditions,
> which gcov later interprets. This is very fast, but introduces an max
> limit for the number of terms in a single boolean expression. This limit
> is the number of bits in a gcov_unsigned_type (which is typedef'd to
> uint64_t), so for most practical purposes this would be acceptable.
> limitation can be relaxed with a more sophisticated way of storing and
> updating bitsets (for example length-encoding).
For multi-threaded applications using -fprofile-update=atomic is quite
important. Unfortunately, not all 32-bit targets support 64-bit atomic
operations in hardware. There is a target hook to select the size of
gcov_type. Maybe a dedicated 64-bit type should be used for the bitfield
using two 32-bit atomic OR if necessary.
>
> In action it looks pretty similar to the branch coverage. The -g short
> opt carries no significance, but was chosen because it was an available
> option with the upper-case free too.
>
> gcov --conditions:
>
> 3: 17:void fn (int a, int b, int c, int d) {
> 3: 18: if ((a && (b || c)) && d)
> conditions covered 5/8
> condition 1 not covered (false)
> condition 2 not covered (true)
> condition 2 not covered (false)
> 1: 19: x = 1;
> -: 20: else
> 2: 21: x = 2;
> 3: 22:}
I have some trouble to understand the output. Would 8/8 mean that we
have 100% MC/DC coverage? What does "not covered (false)" or "not
covered (true)" mean?
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
next prev parent reply other threads:[~2022-04-04 8:14 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 11:55 Jørgen Kvalsvik
2022-03-24 16:08 ` Martin Liška
2022-03-25 19:44 ` Jørgen Kvalsvik
2022-03-28 13:39 ` Martin Liška
2022-03-28 13:52 ` Jørgen Kvalsvik
2022-03-28 14:40 ` Jørgen Kvalsvik
2022-04-07 12:04 ` Martin Liška
2022-04-19 14:22 ` Jørgen Kvalsvik
2022-04-07 16:53 ` Sebastian Huber
2022-04-08 7:28 ` Jørgen Kvalsvik
2022-04-08 7:33 ` Jørgen Kvalsvik
2022-04-08 8:50 ` Sebastian Huber
2022-04-04 8:14 ` Sebastian Huber [this message]
2022-04-05 7:04 ` Sebastian Huber
2022-04-05 20:07 ` Jørgen Kvalsvik
2022-04-06 7:35 ` Sebastian Huber
2022-04-17 11:27 ` Jørgen Kvalsvik
2022-04-22 5:37 ` Sebastian Huber
2022-04-22 10:13 ` Jørgen Kvalsvik
2022-07-08 13:45 ` Sebastian Huber
2022-07-11 7:26 ` Jørgen Kvalsvik
2022-07-11 10:02 Jørgen Kvalsvik
2022-07-12 14:05 ` Sebastian Huber
2022-07-13 2:04 ` Jørgen Kvalsvik
2022-07-15 11:39 Jørgen Kvalsvik
2022-07-15 11:47 ` Jørgen Kvalsvik
2022-07-15 13:31 ` Sebastian Huber
2022-07-15 13:47 ` Jørgen Kvalsvik
2022-08-02 7:58 ` Jørgen Kvalsvik
2022-08-04 7:43 ` Sebastian Huber
2022-08-04 9:13 ` Jørgen Kvalsvik
2022-10-12 10:16 Jørgen Kvalsvik
2022-10-18 0:17 ` Hans-Peter Nilsson
2022-10-18 10:13 ` Jørgen Kvalsvik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1ee43d5d-9c6c-f55b-e5b1-c82a6ff5f653@embedded-brains.de \
--to=sebastian.huber@embedded-brains.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jorgen.kvalsvik@woven-planet.global \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).