[llvm-commits] [compiler-rt] r154159 - in /compiler-rt/trunk/lib/asan: asan_internal.h asan_posix.cc asan_rtl.cc asan_win.cc

Kostya Serebryany kcc at google.com
Thu Apr 5 18:27:11 PDT 2012


Author: kcc
Date: Thu Apr  5 20:27:11 2012
New Revision: 154159

URL: http://llvm.org/viewvc/llvm-project?rev=154159&view=rev
Log:
[asan] add flags: disable_core, abort_on_error and unmap_shadow_on_exit

Modified:
    compiler-rt/trunk/lib/asan/asan_internal.h
    compiler-rt/trunk/lib/asan/asan_posix.cc
    compiler-rt/trunk/lib/asan/asan_rtl.cc
    compiler-rt/trunk/lib/asan/asan_win.cc

Modified: compiler-rt/trunk/lib/asan/asan_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=154159&r1=154158&r2=154159&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_internal.h Thu Apr  5 20:27:11 2012
@@ -263,6 +263,7 @@
 void NORETURN AsanDie();
 void SleepForSeconds(int seconds);
 void NORETURN Exit(int exitcode);
+void NORETURN Abort();
 int Atexit(void (*function)(void));
 
 #define CHECK(cond) do { if (!(cond)) { \

Modified: compiler-rt/trunk/lib/asan/asan_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_posix.cc?rev=154159&r1=154158&r2=154159&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_posix.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_posix.cc Thu Apr  5 20:27:11 2012
@@ -140,6 +140,10 @@
   _exit(exitcode);
 }
 
+void Abort() {
+  abort();
+}
+
 int Atexit(void (*function)(void)) {
   return atexit(function);
 }

Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=154159&r1=154158&r2=154159&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Thu Apr  5 20:27:11 2012
@@ -45,9 +45,12 @@
 bool   FLAG_replace_cfallocator;  // Used on Mac only.
 size_t FLAG_max_malloc_fill_size = 0;
 bool   FLAG_use_fake_stack;
+bool   FLAG_abort_on_error;
 int    FLAG_exitcode = ASAN_DEFAULT_FAILURE_EXITCODE;
 bool   FLAG_allow_user_poisoning;
 int    FLAG_sleep_before_dying;
+bool   FLAG_unmap_shadow_on_exit;
+bool   FLAG_disable_core;
 
 // -------------------------- Globals --------------------- {{{1
 int asan_inited;
@@ -115,8 +118,12 @@
     Report("Sleeping for %d second(s)\n", FLAG_sleep_before_dying);
     SleepForSeconds(FLAG_sleep_before_dying);
   }
+  if (FLAG_unmap_shadow_on_exit)
+    AsanUnmapOrDie((void*)kLowShadowBeg, kHighShadowEnd - kLowShadowBeg);
   if (death_callback)
     death_callback();
+  if (FLAG_abort_on_error)
+    Abort();
   Exit(FLAG_exitcode);
 }
 
@@ -456,6 +463,11 @@
   FLAG_allow_user_poisoning = IntFlagValue(options,
                                            "allow_user_poisoning=", 1);
   FLAG_sleep_before_dying = IntFlagValue(options, "sleep_before_dying=", 0);
+  FLAG_abort_on_error = IntFlagValue(options, "abort_on_error=", 0);
+  FLAG_unmap_shadow_on_exit = IntFlagValue(options, "unmap_shadow_on_exit=", 0);
+  // By default, disable core dumper on 64-bit --
+  // it makes little sense to dump 16T+ core.
+  FLAG_disable_core = IntFlagValue(options, "disable_core=", __WORDSIZE == 64);
 
   FLAG_quarantine_size = IntFlagValue(options, "quarantine_size=",
       (ASAN_LOW_MEMORY) ? 1UL << 24 : 1UL << 28);
@@ -496,8 +508,7 @@
     CHECK(SHADOW_SCALE >= 3 && SHADOW_SCALE <= 7);
   }
 
-  if (__WORDSIZE == 64) {
-    // Disable core dumper -- it makes little sense to dump 16T+ core.
+  if (FLAG_disable_core) {
     AsanDisableCoreDumper();
   }
 

Modified: compiler-rt/trunk/lib/asan/asan_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_win.cc?rev=154159&r1=154158&r2=154159&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_win.cc Thu Apr  5 20:27:11 2012
@@ -299,6 +299,10 @@
   _exit(exitcode);
 }
 
+void Abort() {
+  abort();
+}
+
 int Atexit(void (*function)(void)) {
   return atexit(function);
 }





More information about the llvm-commits mailing list