[compiler-rt] [sanitizers] improve debug output for failed suppression parse (PR #72066)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 12 12:16:18 PST 2023


https://github.com/schenker created https://github.com/llvm/llvm-project/pull/72066

If a sanitizer suppression file can not be parsed, add the supported suppression types to the error message.

See https://github.com/llvm/llvm-project/issues/72060.

>From ba9bb00e8edb7b87eede1c3005fdbf5124c78e21 Mon Sep 17 00:00:00 2001
From: Thomas Schenker <thomas.schenker at protonmail.com>
Date: Sun, 12 Nov 2023 21:05:01 +0100
Subject: [PATCH] [sanitizers] improve debug output for failed suppression
 parse

If a suppression file can not be parsed, add the supported suppression
types to the error message.
---
 compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp
index f3818526baab1b7..a94178828bd80db 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cpp
@@ -139,6 +139,10 @@ void SuppressionContext::Parse(const char *str) {
       }
       if (type == suppression_types_num_) {
         Printf("%s: failed to parse suppressions\n", SanitizerToolName);
+        Printf("Supported suppression types are:\n");
+        for (type = 0; type < suppression_types_num_; type++) {
+          Printf("- %s\n", suppression_types_[type]);
+        }
         Die();
       }
       Suppression s;



More information about the llvm-commits mailing list