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

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 10:44:53 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL253691:  [asan] On OS X, write error reports into Crash Report. (authored by zaks).

Changed prior to commit:
  http://reviews.llvm.org/D14791?vs=40570&id=40801#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14791

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h

Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.h
+++ compiler-rt/trunk/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__[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
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
@@ -453,6 +453,10 @@
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14791.40801.patch
Type: text/x-patch
Size: 1506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151120/657fab15/attachment.bin>


More information about the llvm-commits mailing list