[sanitizers] Allocate 12MB for stack instead of 134MB
authorReid Kleckner <rnk@google.com>
Tue, 12 Jul 2016 20:10:28 +0000 (20:10 +0000)
committerReid Kleckner <rnk@google.com>
Tue, 12 Jul 2016 20:10:28 +0000 (20:10 +0000)
The thread registry test was failing to allocate 25 threads with stack
size 134MB, which is pretty reasonable.

Also print the error code in our pthread wrappers in case this happens
again.

llvm-svn: 275209

compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
compiler-rt/lib/sanitizer_common/tests/sanitizer_pthread_wrappers.h

index 1d65dc2..0a828dc 100644 (file)
@@ -82,7 +82,7 @@ endif()
 # enough for the unittests. Some unittests require more than 2M.
 # The default stack size for clang is 8M.
 if(MSVC)
-  list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -Wl,/STACK:0x8000000)
+  list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -Wl,/STACK:0xC00000)
 endif()
 
 set(SANITIZER_TEST_LINK_LIBS)
index 47b0f97..b7d784c 100644 (file)
@@ -48,7 +48,9 @@ inline void PTHREAD_CREATE(pthread_t *thread, void *attr,
   data->start_routine = start_routine;
   data->arg = arg;
   *thread = CreateThread(0, 0, PthreadHelperThreadProc, data, 0, 0);
-  ASSERT_NE(nullptr, *thread) << "Failed to create a thread.";
+  DWORD err = GetLastError();
+  ASSERT_NE(nullptr, *thread) << "Failed to create a thread, got error 0x"
+                              << std::hex << err;
 }
 
 inline void PTHREAD_JOIN(pthread_t thread, void **value_ptr) {