[all-commits] [llvm/llvm-project] d08107: [lldb] Modernize ThreadLauncher

Pavel Labath via All-commits all-commits at lists.llvm.org
Wed Feb 23 05:26:26 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d0810779b1f310d99176467d5d5b5aa4e26d7eb5
      https://github.com/llvm/llvm-project/commit/d0810779b1f310d99176467d5d5b5aa4e26d7eb5
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M lldb/include/lldb/Core/Communication.h
    M lldb/include/lldb/Core/Debugger.h
    M lldb/include/lldb/Host/ThreadLauncher.h
    M lldb/include/lldb/Target/Process.h
    M lldb/source/API/SBHostOS.cpp
    M lldb/source/Core/Communication.cpp
    M lldb/source/Core/Debugger.cpp
    M lldb/source/Host/common/Host.cpp
    M lldb/source/Host/common/HostNativeThreadBase.cpp
    M lldb/source/Host/common/ThreadLauncher.cpp
    M lldb/source/Host/macosx/objcxx/Host.mm
    M lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    M lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
    M lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
    M lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    M lldb/source/Target/Process.cpp
    M lldb/unittests/Host/CMakeLists.txt
    A lldb/unittests/Host/ThreadLauncherTest.cpp

  Log Message:
  -----------
  [lldb] Modernize ThreadLauncher

Accept a function object instead of a raw pointer. This avoids a bunch
of boilerplate typically needed to pass arguments to the thread
functions.

Differential Revision: https://reviews.llvm.org/D120321


  Commit: f4568e12219f3a6ada20035ea40223680e274203
      https://github.com/llvm/llvm-project/commit/f4568e12219f3a6ada20035ea40223680e274203
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M lldb/include/lldb/Host/macosx/HostThreadMacOSX.h
    M lldb/source/Host/macosx/objcxx/HostThreadMacOSX.mm

  Log Message:
  -----------
  [lldb] Simplify HostThreadMacOSX

The class is using an incredibly elaborate setup to create and destroy
an NSAutoreleasePool object. We can do it in a much simpler way by
making those calls inside our thread startup function.

The only effect of this patch is that the pool gets released at the end
of the ThreadCreateTrampoline function, instead of slightly later, when
pthreads begin thread-specific cleanup. However, the key destruction
order is unspecified, so nothing should be relying on that.

I didn't find a specific reason for why this would have to be done that
way in git history. It seems that before D5198, this was thread-specific
keys were the only way an os implementation (in Host::ThreadCreated)
could attach some value to a thread.

Differential Revision: https://reviews.llvm.org/D120322


Compare: https://github.com/llvm/llvm-project/compare/40f908195807...f4568e12219f


More information about the All-commits mailing list