diff options
| author | Dan Albert <danalbert@google.com> | 2015-01-16 20:00:49 +0000 |
|---|---|---|
| committer | Dan Albert <danalbert@google.com> | 2015-01-16 20:00:49 +0000 |
| commit | b32408e092633203885d19ff02b956030168b451 (patch) | |
| tree | b20c8310df2de697f6ca28fd4ff4946749353684 | |
| parent | bb6718b30e04e84e35e00c685d8abf1e78a82145 (diff) | |
| download | bcm5719-llvm-b32408e092633203885d19ff02b956030168b451.tar.gz bcm5719-llvm-b32408e092633203885d19ff02b956030168b451.zip | |
Fix abort_message.cpp for the NDK.
The NDK doesn't have access to `android/set_abort_message.h`, so use
an extern declaration instead for API 21. For older releases, just use
`__assert2`, which will report to logcat and/or the tombstone for some
older releases.
llvm-svn: 226310
| -rw-r--r-- | libcxxabi/src/abort_message.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libcxxabi/src/abort_message.cpp b/libcxxabi/src/abort_message.cpp index 3158ada4982..7702904fc0f 100644 --- a/libcxxabi/src/abort_message.cpp +++ b/libcxxabi/src/abort_message.cpp @@ -13,9 +13,14 @@ #include "abort_message.h" #ifdef __BIONIC__ -#include <android/set_abort_message.h> +#include <android/api-level.h> +#if __ANDROID_API__ >= 21 #include <syslog.h> -#endif +extern "C" void android_set_abort_message(const char* msg); +#else +#include <assert.h> +#endif // __ANDROID_API__ >= 21 +#endif // __BIONIC__ #pragma GCC visibility push(hidden) @@ -54,6 +59,7 @@ void abort_message(const char* format, ...) vasprintf(&buffer, format, list2); va_end(list2); +#if __ANDROID_API__ >= 21 // Show error in tombstone. android_set_abort_message(buffer); @@ -61,7 +67,13 @@ void abort_message(const char* format, ...) openlog("libc++abi", 0, 0); syslog(LOG_CRIT, "%s", buffer); closelog(); -#endif +#else + // The good error reporting wasn't available in Android until L. Since we're + // about to abort anyway, just call __assert2, which will log _somewhere_ + // (tombstone and/or logcat) in older releases. + __assert2(__FILE__, __LINE__, __func__, buffer); +#endif // __ANDROID_API__ >= 21 +#endif // __BIONIC__ abort(); } |

