[compiler-rt] 5a2071b - [compiler-rt][rtsan] Improve error message wording to match ASan style (#107620)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 14:20:35 PDT 2024
Author: Chris Apple
Date: 2024-09-10T14:20:32-07:00
New Revision: 5a2071b184e00f086f5b538f2209bcdb8aba3078
URL: https://github.com/llvm/llvm-project/commit/5a2071b184e00f086f5b538f2209bcdb8aba3078
DIFF: https://github.com/llvm/llvm-project/commit/5a2071b184e00f086f5b538f2209bcdb8aba3078.diff
LOG: [compiler-rt][rtsan] Improve error message wording to match ASan style (#107620)
Added:
Modified:
compiler-rt/lib/rtsan/rtsan_context.cpp
compiler-rt/lib/rtsan/tests/rtsan_test_utilities.h
compiler-rt/test/rtsan/basic.cpp
compiler-rt/test/rtsan/disabler.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/rtsan/rtsan_context.cpp b/compiler-rt/lib/rtsan/rtsan_context.cpp
index a49b70360babbd..8609394fa222fc 100644
--- a/compiler-rt/lib/rtsan/rtsan_context.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_context.cpp
@@ -95,10 +95,11 @@ void __rtsan::PrintDiagnostics(const char *intercepted_function_name, uptr pc,
uptr bp) {
ScopedErrorReportLock l;
- fprintf(stderr,
- "Real-time violation: intercepted call to real-time unsafe function "
- "`%s` in real-time context! Stack trace:\n",
- intercepted_function_name);
+ Report("ERROR: RealtimeSanitizer: unsafe-library-call\n");
+ Printf("Intercepted call to real-time unsafe function "
+ "`%s` in real-time context!\n",
+ intercepted_function_name);
+
__rtsan::PrintStackTrace(pc, bp);
}
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_utilities.h b/compiler-rt/lib/rtsan/tests/rtsan_test_utilities.h
index 6ca09cf6570940..4ba4fc5e530864 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_utilities.h
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_utilities.h
@@ -30,9 +30,10 @@ void ExpectRealtimeDeath(Function &&Func,
auto GetExpectedErrorSubstring = [&]() -> std::string {
return intercepted_method_name != nullptr
- ? "Real-time violation: intercepted call to real-time unsafe "
- "function `" +
- std::string(intercepted_method_name) + "`"
+ ? ".*==ERROR: RealtimeSanitizer: unsafe-library-call.*"
+ "Intercepted call to real-time unsafe function `" +
+ std::string(intercepted_method_name) +
+ "` in real-time context!"
: "";
};
diff --git a/compiler-rt/test/rtsan/basic.cpp b/compiler-rt/test/rtsan/basic.cpp
index f4075bb27e4f91..607db90213a30d 100644
--- a/compiler-rt/test/rtsan/basic.cpp
+++ b/compiler-rt/test/rtsan/basic.cpp
@@ -17,6 +17,7 @@ void violation() [[clang::nonblocking]] {
int main() {
violation();
return 0;
- // CHECK: Real-time violation: intercepted call to real-time unsafe function `malloc` in real-time context! Stack trace:
+ // CHECK: ==ERROR: RealtimeSanitizer: unsafe-library-call
+ // CHECK-NEXT: Intercepted call to real-time unsafe function `malloc` in real-time context!
// CHECK-NEXT: {{.*malloc*}}
}
diff --git a/compiler-rt/test/rtsan/disabler.cpp b/compiler-rt/test/rtsan/disabler.cpp
index 0a6411a2be6945..dd1d4439beae49 100644
--- a/compiler-rt/test/rtsan/disabler.cpp
+++ b/compiler-rt/test/rtsan/disabler.cpp
@@ -41,7 +41,7 @@ int main() {
// CHECK: Allocated pointer {{.*}} in disabled context
// CHECK: Allocated second pointer {{.*}} in disabled context
// CHECK: Free'd second pointer in disabled context
- // CHECK: {{.*Real-time violation.*}}
+ // CHECK: ==ERROR: RealtimeSanitizer: unsafe-library-call
// CHECK-NOT: {{.*malloc*}}
// CHECK-NEXT: {{.*free.*}}
}
More information about the llvm-commits
mailing list