Skip to content

Commit 5a2071b

Browse files
authored
[compiler-rt][rtsan] Improve error message wording to match ASan style (#107620)
1 parent d418a03 commit 5a2071b

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
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
}

compiler-rt/test/rtsan/disabler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main() {
4141
// CHECK: Allocated pointer {{.*}} in disabled context
4242
// CHECK: Allocated second pointer {{.*}} in disabled context
4343
// CHECK: Free'd second pointer in disabled context
44-
// CHECK: {{.*Real-time violation.*}}
44+
// CHECK: ==ERROR: RealtimeSanitizer: unsafe-library-call
4545
// CHECK-NOT: {{.*malloc*}}
4646
// CHECK-NEXT: {{.*free.*}}
4747
}

0 commit comments

Comments
 (0)