[compiler-rt] r253691 - [asan] On OS X, write error reports into Crash Report.
Anna Zaks via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 20 10:42:08 PST 2015
Author: zaks
Date: Fri Nov 20 12:42:07 2015
New Revision: 253691
URL: http://llvm.org/viewvc/llvm-project?rev=253691&view=rev
Log:
[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
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=253691&r1=253690&r2=253691&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Fri Nov 20 12:42:07 2015
@@ -453,6 +453,10 @@ void LogFullErrorReport(const char *buff
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) {
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h?rev=253691&r1=253690&r2=253691&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h Fri Nov 20 12:42:07 2015
@@ -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
More information about the llvm-commits
mailing list