mirror of
https://github.com/intel/llvm.git
synced 2026-02-05 13:21:04 +08:00
[sanitizers] improve debug output for failed suppression parse (#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. --------- Co-authored-by: Vitaly Buka <vitalybuka@gmail.com>
This commit is contained in:
@@ -138,7 +138,10 @@ void SuppressionContext::Parse(const char *str) {
|
||||
}
|
||||
}
|
||||
if (type == suppression_types_num_) {
|
||||
Printf("%s: failed to parse suppressions\n", SanitizerToolName);
|
||||
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;
|
||||
|
||||
@@ -130,9 +130,15 @@ TEST_F(SuppressionContextTest, HasSuppressionType) {
|
||||
}
|
||||
|
||||
TEST_F(SuppressionContextTest, RegressionTestForBufferOverflowInSuppressions) {
|
||||
EXPECT_DEATH(ctx_.Parse("race"), "failed to parse suppressions");
|
||||
EXPECT_DEATH(ctx_.Parse("foo"), "failed to parse suppressions");
|
||||
const char *expected_output =
|
||||
"failed to parse suppressions.\n"
|
||||
"Supported suppression types are:\n"
|
||||
"- race\n"
|
||||
"- thread\n"
|
||||
"- mutex\n"
|
||||
"- signal\n";
|
||||
EXPECT_DEATH(ctx_.Parse("race"), expected_output);
|
||||
EXPECT_DEATH(ctx_.Parse("foo"), expected_output);
|
||||
}
|
||||
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
||||
Reference in New Issue
Block a user