[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 3/3] xen: debug: gcov: add condition coverage support


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Thu, 27 Mar 2025 00:40:51 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1K3MmhtzYn9ZPBR2hv+3NHFuXqvZWBepKWcFj7+iASY=; b=E4irhX1N3iYRgA4aq7SygNw5egIiiGo8lK9gwzGsERBxZL4mu9V6FlAFxR3dXmWim/xfwCT5I1A3phviho0nZXQ3jwuBDWRHRhlmTBvvSsDLD5h0vyZVm9YSZmN4leTe7M0Zgw680/DbEIMW5+rQUZAnUrOHYJJU/vPrIZt59v37sgiZFzqnryGi50jiq4bv4ujgFlJqeibwbifGllo0SO88GSOU4aBEXVrZ6udvdNc5KVQ6HV58Dyh2d5+CY/7XZkckdkpjbZBHQPVOqOPq2SXZdbSyf4RSLgTss291yBaFtT6VRTGEMHyb7K1HZX6ZRa7IFVHzjpwYXcaBdvTo3A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P0eKmNW5+C4LCYhzi72QR6kHQ8mS6yP+quXeRTBxQuyWgxm85gA7xozF9y9cWJboSgChIwi0ag/sr+Oi7E25ZT+dOB/4n4U640EoWUowd86wIEluAx94DeRVfgaE30+2iev0bL6yGFbTFHdzDXE9EEVf61r4OTWXsEkzrOsgllTuyL2g0k43U26bTRfUW0ENvJLeso9M5HfVjX3Tsa63IUHF+1yRcY2ReYsIvGtnxWhw9ySGGxdNi4fMQeToim1fCceE37Zf4I2+2PqkMTZj5vBa82EOtPkws5MEkFo+yYjSWSHaqI565ZdJ7B8R0G6W/UwZqRck6/xHogENpTsVDQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 27 Mar 2025 00:41:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbnrDjCZFHUEqigkeOtdvfE9127A==
  • Thread-topic: [PATCH v1 3/3] xen: debug: gcov: add condition coverage support

Condition coverage, also known as MC/DC (modified condition/decision
coverage) is a coverage metric that tracks separate outcomes in
boolean expressions.

This patch adds CONFIG_CONDITION_COVERAGE option to enable MC/DC for
GCC. Clang is not supported right now.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
---
 xen/Kconfig.debug             | 9 +++++++++
 xen/Rules.mk                  | 3 +++
 xen/common/coverage/gcc_4_7.c | 4 ++++
 3 files changed, 16 insertions(+)

diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index f7cc5ffaab..7f758d221b 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -44,6 +44,15 @@ config COVERAGE
 
          If unsure, say N here.
 
+config CONDITION_COVERAGE
+       bool "Condition coverage support"
+       depends on COVERAGE && !CC_IS_CLANG
+       help
+         Enable condition coverage support. Used for collecting MC/DC
+         (Modified Condition/Decision Coverage) metrics.
+
+         If unsure, say N here.
+
 config DEBUG_LOCK_PROFILE
        bool "Lock Profiling"
        select DEBUG_LOCKS
diff --git a/xen/Rules.mk b/xen/Rules.mk
index d759cccee3..0a2933cffa 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -138,6 +138,9 @@ ifeq ($(CONFIG_CC_IS_CLANG),y)
     COV_FLAGS := -fprofile-instr-generate -fcoverage-mapping
 else
     COV_FLAGS := -fprofile-arcs -ftest-coverage
+ifeq ($(CONFIG_CONDITION_COVERAGE),y)
+    COV_FLAGS += -fcondition-coverage
+endif
 endif
 
 # Reset COV_FLAGS in cases where an objects has another one as prerequisite
diff --git a/xen/common/coverage/gcc_4_7.c b/xen/common/coverage/gcc_4_7.c
index e3ce69dc2e..d10a16c9a8 100644
--- a/xen/common/coverage/gcc_4_7.c
+++ b/xen/common/coverage/gcc_4_7.c
@@ -43,6 +43,10 @@
 #define GCOV_UNIT_SIZE 4
 #endif
 
+#if defined(CONFIG_CONDITION_COVERAGE) && (GCC_VERSION < 140100)
+#error "GCC 14.1 or never is required to generate conditional coverage data"
+#endif
+
 static struct gcov_info *gcov_info_head;
 
 /**
-- 
2.48.1



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.