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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Fri, 28 Mar 2025 12:19:18 +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=1QGXNEjm7ttDKmdBwGlsNjsh7q36VyjAuzP/PBSR9M4=; b=wzgbZiEKHCK5XonavSguj/w9gwn9X8A9zAHhe3jrhP6q9OLKGNE5ZEztQ/UwX+jGCqAy7EYp8z/UavNnK8FUoWhcPIKzBz3f3ggRFgi0ZK1JmO12NZR3iC7rpMXW481UovTHwB4ZEMP6wIkXd5DdJYJZGZaaSolIYIztuHAc1/ICk7HjENUbYA4GoCPYhDGz/OiCngzoVAGZbjQu+voSW2MDdqJhY4Ap7weMoNW2FdhTfFd0c3sT1ll7dRFgZpnl53BhabAHS88DArwdWHReesFNkqSfweBHysAIjjdnrlKK7HUe76qPVFqcJXKCkzyhtN8YxVxpUgnUylevLUNLuQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P8NvOlarJar+BiNnC+f7gRPfIsBBKi1zZvVTY1bxZg+QiAKYF007vXhMOD/TEetbUwWy8J+4nhLcIlcIuBcK9L0lX5EdRnWiZQXHHS9kLD0CbLHZJqYv5tGzXjGJGWst7evIzEWlj507aSGGKvaBLotVbKNsId9uFsIeW3CnhePugmSTYdOhGb/mdycvFjhISOclEhFjh8Vzf927ESZKbeAW+vaB6I9XRPP2fZAYF47KfbOtvxMiQ2wt1KBMs8uOaR74E6aV86jY/vmnqcnOrXWvHadTFi2MUvzYxDso1I2ptmaWol3ZNoyd3pLvjMed7n3ISzy1H9vD/C+bka9upg==
  • 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: Fri, 28 Mar 2025 12:19:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbn9uhgPsYBM+3ZUSZ+mjdepz+rQ==
  • Thread-topic: [PATCH v2 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>

---

Changes in v2:
 - Move gcc version check from .c file to Rules.mk (I can't find
   an easy way to check GCC version at Kconfig level)
 - Check for gcc 14, not gcc 14.1
---
 xen/Kconfig.debug | 9 +++++++++
 xen/Rules.mk      | 7 +++++++
 2 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..b6f83caad0 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -138,6 +138,13 @@ 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)
+    ifeq ($(call cc-ifversion,-ge,1400,y),y)
+        COV_FLAGS += -fcondition-coverage
+    else
+        $(error "GCC 14 or newer is required for CONFIG_CONDITION_COVERAGE")
+    endif
+endif
 endif
 
 # Reset COV_FLAGS in cases where an objects has another one as prerequisite
-- 
2.48.1



 


Rackspace

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