[PATCH] D14791: [asan] On OS X, write error reports into Crash Report.
Anna Zaks via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 18 15:21:56 PST 2015
zaks.anna created this revision.
zaks.anna added reviewers: glider, kubabrecka, samsonov.
zaks.anna added a subscriber: llvm-commits.
The Crash Report is going to add app specific info if it is stored in the magical buffer.
http://reviews.llvm.org/D14791
Files:
lib/sanitizer_common/sanitizer_mac.cc
lib/sanitizer_common/sanitizer_mac.h
Index: lib/sanitizer_common/sanitizer_mac.h
===================================================================
--- lib/sanitizer_common/sanitizer_mac.h
+++ lib/sanitizer_common/sanitizer_mac.h
@@ -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 @@
} // namespace __sanitizer
+extern "C" {
+static char __crashreporter_info_buff__[ErrorMessageBufferSize] = {};
+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
Index: lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- lib/sanitizer_common/sanitizer_mac.cc
+++ lib/sanitizer_common/sanitizer_mac.cc
@@ -431,6 +431,10 @@
BlockingMutexLock l(&syslog_lock);
if (common_flags()->log_to_syslog)
WriteToSyslog(buffer->data());
+
+ // Log to CrashLog.
+ if (common_flags()->abort_on_error)
+ CRSetCrashLogMessage(buffer->data());
}
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14791.40570.patch
Type: text/x-patch
Size: 1413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151118/be1431c2/attachment.bin>
More information about the llvm-commits
mailing list