<div dir="ltr">This is on linux. The tests all seem to fail with errors like this:<br><br><div><div>ImportError: /home/ribrdb/llldb/build-tsan/lib/python2.7/site-packages/lldb/_lldb.so: undefined symbol: __tsan_init</div><div>Traceback (most recent call last):</div><div>  File "/home/ribrdb/llldb/tools/lldb/test/dotest.py", line 1366, in <module></div><div>    import lldb</div><div>  File "/home/ribrdb/llldb/build-tsan/lib/python2.7/site-packages/lldb/__init__.py", line 52, in <module></div><div>    _lldb = swig_import_helper()</div><div>  File "/home/ribrdb/llldb/build-tsan/lib/python2.7/site-packages/lldb/__init__.py", line 48, in swig_import_helper</div><div>    _mod = imp.load_module('_lldb', fp, pathname, description)</div></div><div><br></div></div><br><div class="gmail_quote">On Thu, May 14, 2015 at 5:38 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Great results!  I'm especially interested in these IOHandler issues, since we know for sure there are problems here.<br><br>When you say Python can't find tsan, can you elaborate?  I'm not sure how tsan works or the process used to run lldb under tsan, but i bet it's something we can figure out with more information.<br><br>Also, what os is this on?<br><div class="gmail_quote">On Thu, May 14, 2015 at 5:01 PM Ryan Brown <<a href="mailto:ribrdb@google.com" target="_blank">ribrdb@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I just built lldb with tsan. The tests don't seem to work because python can't find tsan, but a quick debugging session found a few issues:<div><br></div><div><div>WARNING: ThreadSanitizer: data race (pid=64299)</div><div>  Write of size 1 at 0x7d4400004bb0 by thread T6:</div><div>    #0 lldb_private::IOHandler::SetIsDone(bool) tools/lldb/include/lldb/Core/IOHandler.h:107</div><div>    #1 lldb_private::Process::PushProcessIOHandler() tools/lldb/source/Target/Process.cpp:5279</div><div>    #2 lldb_private::Process::HandlePrivateEvent(std::shared_ptr<lldb_private::Event>&) tools/lldb/source/Target/Process.cpp:4443</div><div>    #3 lldb_private::Process::RunPrivateStateThread() tools/lldb/source/Target/Process.cpp:4581</div><div>    #4 lldb_private::Process::PrivateStateThread(void*) tools/lldb/source/Target/Process.cpp:4505</div><div>    #5 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81</div><div><br></div><div>  Previous write of size 1 at 0x7d4400004bb0 by main thread:</div><div>    #0 lldb_private::IOHandler::SetIsDone(bool) tools/lldb/include/lldb/Core/IOHandler.h:107</div><div>    #1 IOHandlerProcessSTDIO::Run() tools/lldb/source/Target/Process.cpp:5096</div><div>    #2 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:907</div><div>    #3 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #4 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #5 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #6 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>==================</div><div>WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=64299)</div><div>  Cycle in lock order graph: M31728 (0x7d1000019e58) => M564 (0x7d680001d0f8) => M31728</div><div><br></div><div>  Mutex M564 acquired here while holding mutex M31728 in main thread:</div><div>    #3 Locker tools/lldb/source/Host/common/Mutex.cpp:114</div><div>    #4 lldb_private::ModuleList::FindSymbolsWithNameAndType(lldb_private::ConstString const&, lldb::SymbolType, lldb_private::SymbolContextList&, bool) const tools/lldb/source/Core/ModuleList.cpp:565</div><div>    #5 JITLoaderGDB::GetSymbolAddress(lldb_private::ModuleList&, lldb_private::ConstString const&, lldb::SymbolType) const tools/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:432</div><div>    #6 JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList&) tools/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:109</div><div>    #7 JITLoaderGDB::DidLaunch() tools/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:84</div><div>    #8 lldb_private::JITLoaderList::DidLaunch() tools/lldb/source/Target/JITLoaderList.cpp:60</div><div>    #9 lldb_private::Process::Launch(lldb_private::ProcessLaunchInfo&) tools/lldb/source/Target/Process.cpp:3177</div><div>    #10 lldb_private::platform_linux::PlatformLinux::DebugProcess(lldb_private::ProcessLaunchInfo&, lldb_private::Debugger&, lldb_private::Target*, lldb_private::Error&) tools/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp:805</div><div>    #11 lldb_private::Target::Launch(lldb_private::ProcessLaunchInfo&, lldb_private::Stream*) tools/lldb/source/Target/Target.cpp:2602</div><div>    #12 CommandObjectProcessLaunch::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&) tools/lldb/source/Commands/CommandObjectProcess.cpp:263</div><div>    #13 lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandReturnObject&) tools/lldb/source/Interpreter/CommandObject.cpp:1075</div><div>    #14 lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, lldb_private::ExecutionContext*, bool, bool) tools/lldb/source/Interpreter/CommandInterpreter.cpp:1812</div><div>    #15 lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:2997</div><div>    #16 non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3076</div><div>    #17 lldb_private::IOHandlerEditline::Run() tools/lldb/source/Core/IOHandler.cpp:729</div><div>    #18 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:907</div><div>    #19 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #20 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #21 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #22 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>  Mutex M31728 previously acquired by the same thread here:</div><div>    #3 Locker tools/lldb/source/Host/common/Mutex.cpp:114</div><div>    #4 lldb_private::JITLoaderList::DidLaunch() tools/lldb/source/Target/JITLoaderList.cpp:58</div><div>    #5 lldb_private::Process::Launch(lldb_private::ProcessLaunchInfo&) tools/lldb/source/Target/Process.cpp:3177</div><div>    #6 lldb_private::platform_linux::PlatformLinux::DebugProcess(lldb_private::ProcessLaunchInfo&, lldb_private::Debugger&, lldb_private::Target*, lldb_private::Error&) tools/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp:805</div><div>    #7 lldb_private::Target::Launch(lldb_private::ProcessLaunchInfo&, lldb_private::Stream*) tools/lldb/source/Target/Target.cpp:2602</div><div>    #8 CommandObjectProcessLaunch::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&) tools/lldb/source/Commands/CommandObjectProcess.cpp:263</div><div>    #9 lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandReturnObject&) tools/lldb/source/Interpreter/CommandObject.cpp:1075</div><div>    #10 lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, lldb_private::ExecutionContext*, bool, bool) tools/lldb/source/Interpreter/CommandInterpreter.cpp:1812</div><div>    #11 lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:2997</div><div>    #12 non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3076</div><div>    #13 lldb_private::IOHandlerEditline::Run() tools/lldb/source/Core/IOHandler.cpp:729</div><div>    #14 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:907</div><div>    #15 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #16 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #17 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #18 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>  Mutex M31728 acquired here while holding mutex M564 in thread T6:</div><div>    #3 Locker tools/lldb/source/Host/common/Mutex.cpp:114</div><div>    #4 lldb_private::JITLoaderList::ModulesDidLoad(lldb_private::ModuleList&) tools/lldb/source/Target/JITLoaderList.cpp:74</div><div>    #5 lldb_private::Process::ModulesDidLoad(lldb_private::ModuleList&) tools/lldb/source/Target/Process.cpp:6466</div><div>    #6 lldb_private::Target::ModulesDidLoad(lldb_private::ModuleList&) tools/lldb/source/Target/Target.cpp:1286</div><div>    #7 lldb_private::Target::ModuleAdded(lldb_private::ModuleList const&, std::shared_ptr<lldb_private::Module> const&) tools/lldb/source/Target/Target.cpp:1254</div><div>    #8 non-virtual thunk to lldb_private::Target::ModuleAdded(lldb_private::ModuleList const&, std::shared_ptr<lldb_private::Module> const&) tools/lldb/source/Target/Target.cpp:1256</div><div>    #9 lldb_private::ModuleList::AppendImpl(std::shared_ptr<lldb_private::Module> const&, bool) tools/lldb/source/Core/ModuleList.cpp:111</div><div>    #10 lldb_private::ModuleList::Append(std::shared_ptr<lldb_private::Module> const&) tools/lldb/source/Core/ModuleList.cpp:118</div><div>    #11 lldb_private::Target::GetSharedModule(lldb_private::ModuleSpec const&, lldb_private::Error*) tools/lldb/source/Target/Target.cpp:1810</div><div>    #12 lldb_private::DynamicLoader::LoadModuleAtAddress(lldb_private::FileSpec const&, unsigned long, unsigned long) tools/lldb/source/Core/DynamicLoader.cpp:185</div><div>    #13 DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp:530</div><div>    #14 DynamicLoaderPOSIXDYLD::EntryBreakpointHit(void*, lldb_private::StoppointCallbackContext*, unsigned long, unsigned long) tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp:343</div><div>    #15 lldb_private::BreakpointOptions::InvokeCallback(lldb_private::StoppointCallbackContext*, unsigned long, unsigned long) tools/lldb/source/Breakpoint/BreakpointOptions.cpp:147</div><div>    #16 lldb_private::Breakpoint::InvokeCallback(lldb_private::StoppointCallbackContext*, int) tools/lldb/source/Breakpoint/Breakpoint.cpp:345</div><div>    #17 lldb_private::BreakpointLocation::InvokeCallback(lldb_private::StoppointCallbackContext*) tools/lldb/source/Breakpoint/BreakpointLocation.cpp:222</div><div>    #18 lldb_private::BreakpointLocation::ShouldStop(lldb_private::StoppointCallbackContext*) tools/lldb/source/Breakpoint/BreakpointLocation.cpp:465</div><div>    #19 lldb_private::BreakpointLocationCollection::ShouldStop(lldb_private::StoppointCallbackContext*) tools/lldb/source/Breakpoint/BreakpointLocationCollection.cpp:144</div><div>    #20 lldb_private::BreakpointSite::ShouldStop(lldb_private::StoppointCallbackContext*) tools/lldb/source/Breakpoint/BreakpointSite.cpp:69</div><div>    #21 lldb_private::StopInfoBreakpoint::ShouldStopSynchronous(lldb_private::Event*) tools/lldb/source/Target/StopInfo.cpp:200</div><div>    #22 lldb_private::Thread::ShouldStop(lldb_private::Event*) tools/lldb/source/Target/Thread.cpp:845</div><div>    #23 lldb_private::ThreadList::ShouldStop(lldb_private::Event*) tools/lldb/source/Target/ThreadList.cpp:318</div><div>    #24 lldb_private::Process::ShouldBroadcastEvent(lldb_private::Event*) tools/lldb/source/Target/Process.cpp:4181</div><div>    #25 lldb_private::Process::HandlePrivateEvent(std::shared_ptr<lldb_private::Event>&) tools/lldb/source/Target/Process.cpp:4422</div><div>    #26 lldb_private::Process::RunPrivateStateThread() tools/lldb/source/Target/Process.cpp:4581</div><div>    #27 lldb_private::Process::PrivateStateThread(void*) tools/lldb/source/Target/Process.cpp:4505</div><div>    #28 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81</div><div><br></div><div>  Mutex M564 previously acquired by the same thread here:</div><div>    #3 Locker tools/lldb/source/Host/common/Mutex.cpp:114</div><div>    #4 lldb_private::ModuleList::AppendImpl(std::shared_ptr<lldb_private::Module> const&, bool) tools/lldb/source/Core/ModuleList.cpp:108</div><div>    #5 lldb_private::ModuleList::Append(std::shared_ptr<lldb_private::Module> const&) tools/lldb/source/Core/ModuleList.cpp:118</div><div>    #6 lldb_private::Target::GetSharedModule(lldb_private::ModuleSpec const&, lldb_private::Error*) tools/lldb/source/Target/Target.cpp:1810</div><div>    #7 lldb_private::DynamicLoader::LoadModuleAtAddress(lldb_private::FileSpec const&, unsigned long, unsigned long) tools/lldb/source/Core/DynamicLoader.cpp:185</div><div>    #8 DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp:530</div><div>    #9 DynamicLoaderPOSIXDYLD::EntryBreakpointHit(void*, lldb_private::StoppointCallbackContext*, unsigned long, unsigned long) tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp:343</div><div>    #10 lldb_private::BreakpointOptions::InvokeCallback(lldb_private::StoppointCallbackContext*, unsigned long, unsigned long) tools/lldb/source/Breakpoint/BreakpointOptions.cpp:147</div><div>    #11 lldb_private::Breakpoint::InvokeCallback(lldb_private::StoppointCallbackContext*, int) tools/lldb/source/Breakpoint/Breakpoint.cpp:345</div><div>    #12 lldb_private::BreakpointLocation::InvokeCallback(lldb_private::StoppointCallbackContext*) tools/lldb/source/Breakpoint/BreakpointLocation.cpp:222</div><div>    #13 lldb_private::BreakpointLocation::ShouldStop(lldb_private::StoppointCallbackContext*) tools/lldb/source/Breakpoint/BreakpointLocation.cpp:465</div><div>    #14 lldb_private::BreakpointLocationCollection::ShouldStop(lldb_private::StoppointCallbackContext*) tools/lldb/source/Breakpoint/BreakpointLocationCollection.cpp:144</div><div>    #15 lldb_private::BreakpointSite::ShouldStop(lldb_private::StoppointCallbackContext*) tools/lldb/source/Breakpoint/BreakpointSite.cpp:69</div><div>    #16 lldb_private::StopInfoBreakpoint::ShouldStopSynchronous(lldb_private::Event*) tools/lldb/source/Target/StopInfo.cpp:200</div><div>    #17 lldb_private::Thread::ShouldStop(lldb_private::Event*) tools/lldb/source/Target/Thread.cpp:845</div><div>    #18 lldb_private::ThreadList::ShouldStop(lldb_private::Event*) tools/lldb/source/Target/ThreadList.cpp:318</div><div>    #19 lldb_private::Process::ShouldBroadcastEvent(lldb_private::Event*) tools/lldb/source/Target/Process.cpp:4181</div><div>    #20 lldb_private::Process::HandlePrivateEvent(std::shared_ptr<lldb_private::Event>&) tools/lldb/source/Target/Process.cpp:4422</div><div>    #21 lldb_private::Process::RunPrivateStateThread() tools/lldb/source/Target/Process.cpp:4581</div><div>    #22 lldb_private::Process::PrivateStateThread(void*) tools/lldb/source/Target/Process.cpp:4505</div><div>    #23 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81</div><div><br></div><div>==================</div><div>WARNING: ThreadSanitizer: data race (pid=64299)</div><div>  Write of size 1 at 0x7d4400004bb1 by thread T2 (mutexes: write M168):</div><div>    #0 lldb_private::IOHandler::Deactivate() tools/lldb/include/lldb/Core/IOHandler.h:131</div><div>    #1 lldb_private::Debugger::PopIOHandler(std::shared_ptr<lldb_private::IOHandler> const&) tools/lldb/source/Core/Debugger.cpp:1064</div><div>    #2 lldb_private::Process::PopProcessIOHandler() tools/lldb/source/Target/Process.cpp:5291</div><div>    #3 lldb_private::Debugger::HandleProcessEvent(std::shared_ptr<lldb_private::Event> const&) tools/lldb/source/Core/Debugger.cpp:1544</div><div>    #4 lldb_private::Debugger::DefaultEventHandler() tools/lldb/source/Core/Debugger.cpp:1634</div><div>    #5 lldb_private::Debugger::EventHandlerThread(void*) tools/lldb/source/Core/Debugger.cpp:1696</div><div>    #6 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81</div><div><br></div><div>  Previous write of size 1 at 0x7d4400004bb1 by main thread:</div><div>    #0 lldb_private::IOHandler::Activate() tools/lldb/include/lldb/Core/IOHandler.h:125</div><div>    #1 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:906</div><div>    #2 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #3 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #4 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #5 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>==================</div><div>WARNING: ThreadSanitizer: data race (pid=64299)</div><div>  Read of size 8 at 0x7da0000080c0 by thread T2 (mutexes: write M168):</div><div>    #0 write <null>:0</div><div>    #1 operator() tools/lldb/source/Host/posix/PipePosix.cpp:416</div><div>    #2 std::_Function_handler<lldb_private::Error (bool&), lldb_private::PipePosix::Write(void const*, unsigned long, unsigned long&)::$_1>::_M_invoke(std::_Any_data const&, bool&) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2056</div><div>    #3 std::function<lldb_private::Error (bool&)>::operator()(bool&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2464</div><div>    #4 (anonymous namespace)::SelectIO(int, bool, std::function<lldb_private::Error (bool&)> const&, std::chrono::duration<long, std::ratio<1l, 1000000l> > const&) tools/lldb/source/Host/posix/PipePosix.cpp:118</div><div>    #5 lldb_private::PipePosix::Write(void const*, unsigned long, unsigned long&) tools/lldb/source/Host/posix/PipePosix.cpp:411</div><div>    #6 IOHandlerProcessSTDIO::Cancel() tools/lldb/source/Target/Process.cpp:5192</div><div>    #7 lldb_private::Debugger::PopIOHandler(std::shared_ptr<lldb_private::IOHandler> const&) tools/lldb/source/Core/Debugger.cpp:1065</div><div>    #8 lldb_private::Process::PopProcessIOHandler() tools/lldb/source/Target/Process.cpp:5291</div><div>    #9 lldb_private::Debugger::HandleProcessEvent(std::shared_ptr<lldb_private::Event> const&) tools/lldb/source/Core/Debugger.cpp:1544</div><div>    #10 lldb_private::Debugger::DefaultEventHandler() tools/lldb/source/Core/Debugger.cpp:1634</div><div>    #11 lldb_private::Debugger::EventHandlerThread(void*) tools/lldb/source/Core/Debugger.cpp:1696</div><div>    #12 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81</div><div><br></div><div>  Previous write of size 8 at 0x7da0000080c0 by main thread:</div><div>    #0 pipe2 <null>:0</div><div>    #1 lldb_private::PipePosix::CreateNew(bool) tools/lldb/source/Host/posix/PipePosix.cpp:168</div><div>    #2 IOHandlerProcessSTDIO::OpenPipes() tools/lldb/source/Target/Process.cpp:5078</div><div>    #3 IOHandlerProcessSTDIO::Run() tools/lldb/source/Target/Process.cpp:5097</div><div>    #4 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:907</div><div>    #5 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #6 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #7 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #8 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>  Location is file descriptor 12 created by main thread at:</div><div>    #0 pipe2 <null>:0</div><div>    #1 lldb_private::PipePosix::CreateNew(bool) tools/lldb/source/Host/posix/PipePosix.cpp:168</div><div>    #2 IOHandlerProcessSTDIO::OpenPipes() tools/lldb/source/Target/Process.cpp:5078</div><div>    #3 IOHandlerProcessSTDIO::Run() tools/lldb/source/Target/Process.cpp:5097</div><div>    #4 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:907</div><div>    #5 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #6 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #7 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #8 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>==================</div><div>WARNING: ThreadSanitizer: data race (pid=64299)</div><div>  Read of size 8 at 0x7d080001a5c8 by main thread:</div><div>    #0 lldb_private::HostNativeThreadBase::GetSystemHandle() const tools/lldb/source/Host/common/HostNativeThreadBase.cpp:35</div><div>    #1 lldb_private::HostThread::EqualsThread(unsigned long) const tools/lldb/source/Host/common/HostThread.cpp:77</div><div>    #2 lldb_private::Process::GetRunLock() tools/lldb/source/Target/Process.cpp:6373</div><div>    #3 lldb_private::ExecutionContextRef::SetTargetPtr(lldb_private::Target*, bool) tools/lldb/source/Target/ExecutionContext.cpp:723</div><div>    #4 lldb_private::CommandInterpreter::UpdateExecutionContext(lldb_private::ExecutionContext*) tools/lldb/source/Interpreter/CommandInterpreter.cpp:2940</div><div>    #5 lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, lldb_private::ExecutionContext*, bool, bool) tools/lldb/source/Interpreter/CommandInterpreter.cpp:1668</div><div>    #6 lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:2997</div><div>    #7 non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3076</div><div>    #8 lldb_private::IOHandlerEditline::Run() tools/lldb/source/Core/IOHandler.cpp:729</div><div>    #9 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:907</div><div>    #10 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #11 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #12 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #13 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>  Previous write of size 8 at 0x7d080001a5c8 by thread T6:</div><div>    #0 memset <null>:0</div><div>    #1 lldb_private::HostNativeThreadBase::Reset() tools/lldb/source/Host/common/HostNativeThreadBase.cpp:54</div><div>    #2 lldb_private::HostThread::Reset() tools/lldb/source/Host/common/HostThread.cpp:41</div><div>    #3 lldb_private::Process::RunPrivateStateThread() tools/lldb/source/Target/Process.cpp:4604</div><div>    #4 lldb_private::Process::PrivateStateThread(void*) tools/lldb/source/Target/Process.cpp:4505</div><div>    #5 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81</div><div><br></div><div>==================</div><div>WARNING: ThreadSanitizer: data race (pid=64299)</div><div>  Write of size 4 at 0x7d680001c8e8 by main thread:</div><div>    #0 lldb_private::Terminal::SetFileDescriptor(int) tools/lldb/include/lldb/Host/Terminal.h:46</div><div>    #1 lldb_private::TerminalState::Save(int, bool) tools/lldb/source/Host/common/Terminal.cpp:144</div><div>    #2 lldb_private::Debugger::SaveInputTerminalState() tools/lldb/source/Core/Debugger.cpp:825</div><div>    #3 lldb::SBDebugger::SaveInputTerminalState() tools/lldb/source/API/SBDebugger.cpp:395</div><div>    #4 sigtstp_handler(int) tools/lldb/tools/driver/Driver.cpp:1203</div><div>    #5 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int, my_siginfo_t*, void*) tsan_interceptors.o:0</div><div>    #6 std::string::_Rep::_M_dispose(std::allocator<char> const&) /build/buildd/gcc-4.8-4.8.2/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.h:538</div><div>    #7 lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:2997</div><div>    #8 non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3076</div><div>    #9 lldb_private::IOHandlerEditline::Run() tools/lldb/source/Core/IOHandler.cpp:729</div><div>    #10 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:907</div><div>    #11 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #12 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #13 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #14 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>  Previous write of size 4 at 0x7d680001c8e8 by thread T2 (mutexes: write M159):</div><div>    #0 lldb_private::Terminal::SetFileDescriptor(int) tools/lldb/include/lldb/Host/Terminal.h:46</div><div>    #1 lldb_private::TerminalState::Save(int, bool) tools/lldb/source/Host/common/Terminal.cpp:144</div><div>    #2 lldb_private::Debugger::SaveInputTerminalState() tools/lldb/source/Core/Debugger.cpp:825</div><div>    #3 lldb::SBDebugger::SaveInputTerminalState() tools/lldb/source/API/SBDebugger.cpp:395</div><div>    #4 sigtstp_handler(int) tools/lldb/tools/driver/Driver.cpp:1203</div><div>    #5 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int, my_siginfo_t*, void*) tsan_interceptors.o:0</div><div>    #6 lldb_private::Condition::Wait(lldb_private::Mutex&, lldb_private::TimeValue const*, bool*) tools/lldb/source/Host/common/Condition.cpp:85</div><div>    #7 lldb_private::Predicate<bool>::WaitForValueEqualTo(bool, lldb_private::TimeValue const*, bool*) tools/lldb/include/lldb/Host/Predicate.h:339</div><div>    #8 lldb_private::Listener::WaitForEventsInternal(lldb_private::TimeValue const*, lldb_private::Broadcaster*, lldb_private::ConstString const*, unsigned int, unsigned int, std::shared_ptr<lldb_private::Event>&) tools/lldb/source/Core/Listener.cpp:442</div><div>    #9 lldb_private::Listener::WaitForEvent(lldb_private::TimeValue const*, std::shared_ptr<lldb_private::Event>&) tools/lldb/source/Core/Listener.cpp:492</div><div>    #10 lldb_private::Debugger::DefaultEventHandler() tools/lldb/source/Core/Debugger.cpp:1623</div><div>    #11 lldb_private::Debugger::EventHandlerThread(void*) tools/lldb/source/Core/Debugger.cpp:1696</div><div>    #12 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81</div><div><br></div><div>==================</div><div>WARNING: ThreadSanitizer: data race (pid=64299)</div><div>  Write of size 4 at 0x7d680001c8ec by main thread:</div><div>    #0 lldb_private::TerminalState::Save(int, bool) tools/lldb/source/Host/common/Terminal.cpp:148</div><div>    #1 lldb_private::Debugger::SaveInputTerminalState() tools/lldb/source/Core/Debugger.cpp:825</div><div>    #2 lldb::SBDebugger::SaveInputTerminalState() tools/lldb/source/API/SBDebugger.cpp:395</div><div>    #3 sigtstp_handler(int) tools/lldb/tools/driver/Driver.cpp:1203</div><div>    #4 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int, my_siginfo_t*, void*) tsan_interceptors.o:0</div><div>    #5 std::string::_Rep::_M_dispose(std::allocator<char> const&) /build/buildd/gcc-4.8-4.8.2/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.h:538</div><div>    #6 lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:2997</div><div>    #7 non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::string&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3076</div><div>    #8 lldb_private::IOHandlerEditline::Run() tools/lldb/source/Core/IOHandler.cpp:729</div><div>    #9 lldb_private::Debugger::ExecuteIOHandlers() tools/lldb/source/Core/Debugger.cpp:907</div><div>    #10 lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) tools/lldb/source/Interpreter/CommandInterpreter.cpp:3234</div><div>    #11 lldb::SBDebugger::RunCommandInterpreter(bool, bool) tools/lldb/source/API/SBDebugger.cpp:980</div><div>    #12 Driver::MainLoop() tools/lldb/tools/driver/Driver.cpp:1152</div><div>    #13 main tools/lldb/tools/driver/Driver.cpp:1252</div><div><br></div><div>  Previous write of size 4 at 0x7d680001c8ec by thread T2 (mutexes: write M159):</div><div>    #0 lldb_private::TerminalState::Save(int, bool) tools/lldb/source/Host/common/Terminal.cpp:148</div><div>    #1 lldb_private::Debugger::SaveInputTerminalState() tools/lldb/source/Core/Debugger.cpp:825</div><div>    #2 lldb::SBDebugger::SaveInputTerminalState() tools/lldb/source/API/SBDebugger.cpp:395</div><div>    #3 sigtstp_handler(int) tools/lldb/tools/driver/Driver.cpp:1203</div><div>    #4 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int, my_siginfo_t*, void*) tsan_interceptors.o:0</div><div>    #5 lldb_private::Condition::Wait(lldb_private::Mutex&, lldb_private::TimeValue const*, bool*) tools/lldb/source/Host/common/Condition.cpp:85</div><div>    #6 lldb_private::Predicate<bool>::WaitForValueEqualTo(bool, lldb_private::TimeValue const*, bool*) tools/lldb/include/lldb/Host/Predicate.h:339</div><div>    #7 lldb_private::Listener::WaitForEventsInternal(lldb_private::TimeValue const*, lldb_private::Broadcaster*, lldb_private::ConstString const*, unsigned int, unsigned int, std::shared_ptr<lldb_private::Event>&) tools/lldb/source/Core/Listener.cpp:442</div><div>    #8 lldb_private::Listener::WaitForEvent(lldb_private::TimeValue const*, std::shared_ptr<lldb_private::Event>&) tools/lldb/source/Core/Listener.cpp:492</div><div>    #9 lldb_private::Debugger::DefaultEventHandler() tools/lldb/source/Core/Debugger.cpp:1623</div><div>    #10 lldb_private::Debugger::EventHandlerThread(void*) tools/lldb/source/Core/Debugger.cpp:1696</div><div>    #11 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81</div></div><div><br></div></div><div class="gmail_extra"></div><div class="gmail_extra"><br clear="all"><div><div>-- Ryan Brown<br></div></div></div><div class="gmail_extra">
<br><div class="gmail_quote">On Mon, May 11, 2015 at 8:20 AM, Ed Maste <span dir="ltr"><<a href="mailto:emaste@freebsd.org" target="_blank">emaste@freebsd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 11 May 2015 at 10:21, Pavel Labath <<a href="mailto:labath@google.com" target="_blank">labath@google.com</a>> wrote:<br>
><br>
> BTW, I've noticed that PushIOHandler does not lock<br>
> m_input_reader_stack.GetMutex(), unlike PopIOHandler, and all other<br>
> functions which deal with handlers. Is that intentional? I think it<br>
> should lock the mutex as well.<br>
<br>
</span>A slight tangent here, but there's a lot of dubious thread behaviour<br>
like this. One example I've run into is PR22611 - I see that if we set<br>
a prompt that fits in libc++'s short string optimization (that is, no<br>
more than 22 characters) it works fine, but as soon as the prompt is<br>
23 characters long we end up pointing at uninitialized memory;<br>
presumably the race window is much larger in that case.<br>
<br>
Unfortunately TSan isn't fully functional on FreeBSD at the moment, so<br>
it's not that easy for me to find other cases like this with a<br>
systematic approach. I recall there was an effort to run LLDB under<br>
TSan on Linux some time ago, and that found a number of issues. Is<br>
anyone on the Linux side interested in picking that up again?<br>
<div><div>_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
</div></div></blockquote></div><br></div>
_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
</blockquote></div>
</blockquote></div>