diff options
Diffstat (limited to 'compiler-rt/lib/asan/asan_report.cc')
| -rw-r--r-- | compiler-rt/lib/asan/asan_report.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler-rt/lib/asan/asan_report.cc b/compiler-rt/lib/asan/asan_report.cc index 883b84b26a2..1cabbcdd91c 100644 --- a/compiler-rt/lib/asan/asan_report.cc +++ b/compiler-rt/lib/asan/asan_report.cc @@ -21,7 +21,7 @@ namespace __asan { -// ---------------------- Error report callback ------------------- {{{1 +// -------------------- User-specified callbacks ----------------- {{{1 static void (*error_report_callback)(const char*); static char *error_message_buffer = 0; static uptr error_message_buffer_pos = 0; @@ -40,6 +40,8 @@ void AppendToErrorMessageBuffer(const char *buffer) { } } +static void (*on_error_callback)(void); + // ---------------------- Helper functions ----------------------- {{{1 static void PrintBytes(const char *before, uptr *a) { @@ -219,6 +221,9 @@ class ScopedInErrorReport { SleepForSeconds(Max(5, flags()->sleep_before_dying + 1)); Die(); } + if (on_error_callback) { + on_error_callback(); + } AsanPrintf("====================================================" "=============\n"); AsanThread *curr_thread = asanThreadRegistry().GetCurrent(); @@ -409,3 +414,7 @@ void NOINLINE __asan_set_error_report_callback(void (*callback)(const char*)) { error_message_buffer_pos = 0; } } + +void NOINLINE __asan_set_on_error_callback(void (*callback)(void)) { + on_error_callback = callback; +} |

