[Lldb-commits] [PATCH] D157648: [lldb] Fix data race in Process

Augusto Noronha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 10 15:47:17 PDT 2023


augusto2112 added a comment.

In D157648#4578420 <https://reviews.llvm.org/D157648#4578420>, @JDevlieghere wrote:

> Is the reported race specifically about the shared pointer being accessed concurrently or operations on the `IOHandler`?

I believe it's the shared pointer being accessed. Here's an example of what's being reported:

  WARNING: ThreadSanitizer: data race (pid=52249)
    Read of size 8 at 0x00010731ce38 by thread T3:
      #0 lldb_private::Process::PopProcessIOHandler() Process.cpp:4559 (liblldb.18.0.0git.dylib:arm64+0x53a5a4) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
      #1 lldb_private::Process::HandlePrivateEvent(std::__1::shared_ptr<lldb_private::Event>&) Process.cpp:3775 (liblldb.18.0.0git.dylib:arm64+0x54204c) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
      #2 lldb_private::Process::RunPrivateStateThread(bool) Process.cpp:3904 (liblldb.18.0.0git.dylib:arm64+0x54874c) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
      #3 std::__1::__function::__func<lldb_private::Process::StartPrivateStateThread(bool)::$_5, std::__1::allocator<lldb_private::Process::StartPrivateStateThread(bool)::$_5>, void* ()>::operator()() function.h:356 (liblldb.18.0.0git.dylib:arm64+0x555de4) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
      #4 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) HostNativeThreadBase.cpp:62 (liblldb.18.0.0git.dylib:arm64+0x3e83fc) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
      #5 lldb_private::HostThreadMacOSX::ThreadCreateTrampoline(void*) HostThreadMacOSX.mm:18 (liblldb.18.0.0git.dylib:arm64+0x175056c) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
  
    Previous write of size 8 at 0x00010731ce38 by main thread (mutexes: write M0):
      #0 lldb_private::Process::SetSTDIOFileDescriptor(int) Process.cpp:4528 (liblldb.18.0.0git.dylib:arm64+0x54aa5c) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
      #1 lldb_private::Platform::DebugProcess(lldb_private::ProcessLaunchInfo&, lldb_private::Debugger&, lldb_private::Target&, lldb_private::Status&) Platform.cpp:1120 (liblldb.18.0.0git.dylib:arm64+0x52bc54) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
      #2 lldb_private::PlatformDarwin::DebugProcess(lldb_private::ProcessLaunchInfo&, lldb_private::Debugger&, lldb_private::Target&, lldb_private::Status&) PlatformDarwin.cpp:711 (liblldb.18.0.0git.dylib:arm64+0x872cc8) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)
      #3 lldb_private::Target::Launch(lldb_private::ProcessLaunchInfo&, lldb_private::Stream*) Target.cpp:3235 (liblldb.18.0.0git.dylib:arm64+0x5b118c) (BuildId: 6e77321523b936d2955d63d4d25df7cd32000000200000000100000000000e00)

Line 4559 is

  IOHandlerSP io_handler_sp(m_process_input_reader);

Line 4528 is

  m_process_input_reader =
      std::make_shared<IOHandlerProcessSTDIO>(this, fd);


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157648/new/

https://reviews.llvm.org/D157648



More information about the lldb-commits mailing list