mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 21:55:39 +08:00
[asan] Add support for Android debug message.
Add ASan report to the "debug message" field in Android tombstones. llvm-svn: 306184
This commit is contained in:
@@ -204,6 +204,14 @@ class ScopedInErrorReport {
|
||||
error_report_callback(buffer_copy.data());
|
||||
}
|
||||
|
||||
if (halt_on_error_ && common_flags()->abort_on_error) {
|
||||
// On Android the message is truncated to 512 characters.
|
||||
// FIXME: implement "compact" error format, possibly without, or with
|
||||
// highly compressed stack traces?
|
||||
// FIXME: or just use the summary line as abort message?
|
||||
SetAbortMessage(buffer_copy.data());
|
||||
}
|
||||
|
||||
// In halt_on_error = false mode, reset the current error object (before
|
||||
// unlocking).
|
||||
if (!halt_on_error_)
|
||||
|
||||
@@ -810,8 +810,11 @@ INLINE void LogMessageOnPrintf(const char *str) {}
|
||||
#if SANITIZER_LINUX
|
||||
// Initialize Android logging. Any writes before this are silently lost.
|
||||
void AndroidLogInit();
|
||||
void SetAbortMessage(const char *);
|
||||
#else
|
||||
INLINE void AndroidLogInit() {}
|
||||
// FIXME: MacOS implementation could use CRSetCrashLogMessage.
|
||||
INLINE void SetAbortMessage(const char *) {}
|
||||
#endif
|
||||
|
||||
#if SANITIZER_ANDROID
|
||||
|
||||
@@ -551,6 +551,13 @@ void LogMessageOnPrintf(const char *str) {
|
||||
WriteToSyslog(str);
|
||||
}
|
||||
|
||||
#if SANITIZER_ANDROID && __ANDROID_API__ >= 21
|
||||
extern "C" void android_set_abort_message(const char *msg);
|
||||
void SetAbortMessage(const char *str) { android_set_abort_message(str); }
|
||||
#else
|
||||
void SetAbortMessage(const char *str) {}
|
||||
#endif
|
||||
|
||||
#endif // SANITIZER_LINUX
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
||||
Reference in New Issue
Block a user