Skip to content

Commit 7d45166

Browse files
committed
[compiler-rt][rtsan] Improve error message wording to match ASan style
1 parent d9a9960 commit 7d45166

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

compiler-rt/lib/rtsan/rtsan_context.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@ void __rtsan::PrintDiagnostics(const char *intercepted_function_name, uptr pc,
9595
uptr bp) {
9696
ScopedErrorReportLock l;
9797

98-
fprintf(stderr,
99-
"Real-time violation: intercepted call to real-time unsafe function "
100-
"`%s` in real-time context! Stack trace:\n",
101-
intercepted_function_name);
98+
Report("ERROR: RealtimeSanitizer: unsafe-library-call\n");
99+
Printf("Intercepted call to real-time unsafe function "
100+
"`%s` in real-time context!\n",
101+
intercepted_function_name);
102+
102103
__rtsan::PrintStackTrace(pc, bp);
103104
}
104105

compiler-rt/lib/rtsan/tests/rtsan_test_utilities.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ void ExpectRealtimeDeath(Function &&Func,
3030

3131
auto GetExpectedErrorSubstring = [&]() -> std::string {
3232
return intercepted_method_name != nullptr
33-
? "Real-time violation: intercepted call to real-time unsafe "
34-
"function `" +
35-
std::string(intercepted_method_name) + "`"
33+
? ".*==ERROR: RealtimeSanitizer: unsafe-library-call.*"
34+
"Intercepted call to real-time unsafe function `" +
35+
std::string(intercepted_method_name) +
36+
"` in real-time context!"
3637
: "";
3738
};
3839

compiler-rt/test/rtsan/basic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ void violation() [[clang::nonblocking]] {
1717
int main() {
1818
violation();
1919
return 0;
20-
// CHECK: Real-time violation: intercepted call to real-time unsafe function `malloc` in real-time context! Stack trace:
20+
// CHECK: ==ERROR: RealtimeSanitizer: unsafe-library-call
21+
// CHECK-NEXT: Intercepted call to real-time unsafe function `malloc` in real-time context!
2122
// CHECK-NEXT: {{.*malloc*}}
2223
}

0 commit comments

Comments
 (0)