diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-04-19 23:17:15 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-04-19 23:17:15 +0100 |
commit | fb938d978801b5608ab91b62197388954546e5d8 (patch) | |
tree | ada3541404b5d9049212cd17ca6c6c0a20412ccc | |
parent | d41db36eaddc1470345b613ee1bbc161d1f1d642 (diff) |
os: Intercept ASAN errors similar to exception.
So that errors / trace flushing works as usual.
-rw-r--r-- | common/os_posix.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/os_posix.cpp b/common/os_posix.cpp index 6092b2aa..74594c3f 100644 --- a/common/os_posix.cpp +++ b/common/os_posix.cpp @@ -61,6 +61,13 @@ #define SA_RESTART 0 // QNX does not have SA_RESTART #endif +#ifndef __has_feature +# define __has_feature(x) 0 +#endif +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) +# include <sanitizer/asan_interface.h> +#endif + #include "os.hpp" #include "os_string.hpp" #include "os_backtrace.hpp" @@ -403,6 +410,10 @@ setExceptionCallback(void (*callback)(void)) sigaction(sig, &new_action, NULL); } } + +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) + __asan_set_death_callback(callback); +#endif } } @@ -410,6 +421,9 @@ void resetExceptionCallback(void) { gCallback = NULL; +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) + __asan_set_death_callback(NULL); +#endif } #ifdef __ANDROID__ |