[asan] On OS X, write error reports into Crash Report.

The Crash Report is going to add app specific info if it is stored in the magical buffer.

Differential Revision: http://reviews.llvm.org/D14791

llvm-svn: 253691
This commit is contained in:
Anna Zaks 2015-11-20 18:42:07 +00:00
parent c54cf07fd7
commit e310f11223
2 changed files with 16 additions and 0 deletions

View File

@ -453,6 +453,10 @@ void LogFullErrorReport(const char *buffer) {
BlockingMutexLock l(&syslog_lock);
if (common_flags()->log_to_syslog)
WriteToSyslog(buffer);
// Log to CrashLog.
if (common_flags()->abort_on_error)
CRSetCrashLogMessage(buffer);
}
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {

View File

@ -13,6 +13,7 @@
#ifndef SANITIZER_MAC_H
#define SANITIZER_MAC_H
#include "sanitizer_common.h"
#include "sanitizer_platform.h"
#if SANITIZER_MAC
#include "sanitizer_posix.h"
@ -37,5 +38,16 @@ char **GetEnviron();
} // namespace __sanitizer
extern "C" {
static char __crashreporter_info_buff__[kErrorMessageBufferSize] = {};
static const char *__crashreporter_info__ __attribute__((__used__)) =
&__crashreporter_info_buff__[0];
asm(".desc ___crashreporter_info__, 0x10");
} // extern "C"
INLINE void CRSetCrashLogMessage(const char *msg) {
internal_strlcpy(__crashreporter_info_buff__, msg,
sizeof(__crashreporter_info_buff__)); }
#endif // SANITIZER_MAC
#endif // SANITIZER_MAC_H