From 3db7ebc87fff4cb80ebbc610469845fa92edd2fa Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 29 Jan 2015 06:28:36 +0000 Subject: [PATCH] If lldb is being built with ASAN instrumentation, have lldb create its own threads with 8MB additional maximum stack size. Extra room is needed for the bookkeeping needed for this instrumentation. llvm-svn: 227421 --- lldb/source/Host/common/ThreadLauncher.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lldb/source/Host/common/ThreadLauncher.cpp b/lldb/source/Host/common/ThreadLauncher.cpp index ec7da325bf92..c19a23361d81 100644 --- a/lldb/source/Host/common/ThreadLauncher.cpp +++ b/lldb/source/Host/common/ThreadLauncher.cpp @@ -38,6 +38,16 @@ ThreadLauncher::LaunchThread(llvm::StringRef name, lldb::thread_func_t thread_fu error.SetError(::GetLastError(), eErrorTypeWin32); #else + + // ASAN instrumentation adds a lot of bookkeeping overhead on stack frames. +#if __has_feature(address_sanitizer) + const size_t eight_megabytes = 8 * 1024 * 1024; + if (min_stack_byte_size < eight_megabytes) + { + min_stack_byte_size += eight_megabytes; + } +#endif + pthread_attr_t *thread_attr_ptr = NULL; pthread_attr_t thread_attr; bool destroy_attr = false;