[compiler-rt] r224852 - [ASan/Win] Suppress error messaging when Abort() is called

Timur Iskhodzhanov timurrrr at google.com
Fri Dec 26 04:25:54 PST 2014


Author: timurrrr
Date: Fri Dec 26 06:25:54 2014
New Revision: 224852

URL: http://llvm.org/viewvc/llvm-project?rev=224852&view=rev
Log:
[ASan/Win] Suppress error messaging when Abort() is called
This will prevent ASan bots from hanging / timing out

Added:
    compiler-rt/trunk/test/asan/TestCases/Windows/shadow_mapping_failure.cc
Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=224852&r1=224851&r2=224852&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Fri Dec 26 06:25:54 2014
@@ -238,8 +238,9 @@ u64 NanoTime() {
 }
 
 void Abort() {
-  abort();
-  internal__exit(-1);  // abort is not NORETURN on Windows.
+  if (::IsDebuggerPresent())
+    __debugbreak();
+  internal__exit(3);
 }
 
 uptr GetListOfModules(LoadedModule *modules, uptr max_modules,

Added: compiler-rt/trunk/test/asan/TestCases/Windows/shadow_mapping_failure.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/shadow_mapping_failure.cc?rev=224852&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/shadow_mapping_failure.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/shadow_mapping_failure.cc Fri Dec 26 06:25:54 2014
@@ -0,0 +1,14 @@
+// RUN: %clang_cl_asan -O0 %s -Fe%t
+// RUN: not %run %t 2>&1 | FileCheck %s
+
+#include <stdio.h>
+
+char bigchunk[1 << 29];
+
+int main() {
+  printf("Hello, world!\n");
+  scanf("%s", bigchunk);
+// CHECK-NOT: Hello, world!
+// CHECK: ERROR: AddressSanitizer failed to allocate
+// CHECK: ReserveShadowMemoryRange failed
+}





More information about the llvm-commits mailing list