|
14 | 14 | #include <rtsan/rtsan_stack.h>
|
15 | 15 |
|
16 | 16 | #include <sanitizer_common/sanitizer_allocator_internal.h>
|
| 17 | +#include <sanitizer_common/sanitizer_report_decorator.h> |
17 | 18 | #include <sanitizer_common/sanitizer_stacktrace.h>
|
18 | 19 |
|
19 | 20 | #include <new>
|
@@ -91,15 +92,28 @@ bool __rtsan::Context::InRealtimeContext() const { return realtime_depth_ > 0; }
|
91 | 92 |
|
92 | 93 | bool __rtsan::Context::IsBypassed() const { return bypass_depth_ > 0; }
|
93 | 94 |
|
| 95 | +namespace { |
| 96 | +class Decorator : public __sanitizer::SanitizerCommonDecorator { |
| 97 | +public: |
| 98 | + Decorator() : SanitizerCommonDecorator() {} |
| 99 | + const char *FunctionName() { return Green(); } |
| 100 | + const char *Reason() { return Blue(); } |
| 101 | +}; |
| 102 | +} // namespace |
| 103 | + |
94 | 104 | void __rtsan::PrintDiagnostics(const char *intercepted_function_name, uptr pc,
|
95 | 105 | uptr bp) {
|
96 | 106 | ScopedErrorReportLock l;
|
97 | 107 |
|
| 108 | + Decorator d; |
| 109 | + Printf("%s", d.Error()); |
98 | 110 | Report("ERROR: RealtimeSanitizer: unsafe-library-call\n");
|
| 111 | + Printf("%s", d.Reason()); |
99 | 112 | Printf("Intercepted call to real-time unsafe function "
|
100 |
| - "`%s` in real-time context!\n", |
101 |
| - intercepted_function_name); |
| 113 | + "`%s%s%s` in real-time context!\n", |
| 114 | + d.FunctionName(), intercepted_function_name, d.Reason()); |
102 | 115 |
|
| 116 | + Printf("%s", d.Default()); |
103 | 117 | __rtsan::PrintStackTrace(pc, bp);
|
104 | 118 | }
|
105 | 119 |
|
|
0 commit comments