[Lldb-commits] [PATCH] First pass at HostThreads refactor

Zachary Turner zturner at google.com
Thu Sep 4 14:04:52 PDT 2014


Hi tfiala,

This patch is a first attempt at creating a HostThread abstraction.  This is based on previous discussion on the list.  There are a few issues that still need to be worked out, but this is being posted preliminarily to deal with any high-level issues.

Key summary of changes:

* Threads inside the LLDB process are managed by the HostThread class.
* HostThread is a typedef for one of: {HostThreadWindows, HostThreadMacOSX, HostThreadFreeBSD}, all of which inherit from HostThreadBase which defines a common interface and set of utility functions.
* Create a new thread by calling ThreadRunner::LaunchThread()
* A new class named ThisThread is introduced which allows manipulation and inspection of the currently running thread.  Current functionality only allows querying and setting the name.

One of the remaining issues is some deadlocks in ProcessPOSIX and ProcessLinux.  I'm still not sure what's causing this, but am looking into it.  Would appreciate some help from a Linux guru, although I will keep at it in the meantime.  

I also plan to add more comments on the member functions in some of the header files for newly introduced classes.

This patch should apply cleanly on top of git revision a45429b9052517c6a2cb319a07f6b1d2c956ea3a, but due to the size of the patch it may not apply cleanly on top of other revisions.  I tried to separate up the patch, but it was fairly difficult and I was unable to make it work cleanly.

http://reviews.llvm.org/D5198

Files:
  include/lldb/Core/Communication.h
  include/lldb/Core/DataBuffer.h
  include/lldb/Core/Debugger.h
  include/lldb/Host/Host.h
  include/lldb/Host/HostInfoBase.h
  include/lldb/Host/HostThread.h
  include/lldb/Host/HostThreadBase.h
  include/lldb/Host/ThisThread.h
  include/lldb/Host/ThreadRunner.h
  include/lldb/Host/freebsd/HostInfoFreeBSD.h
  include/lldb/Host/freebsd/HostThreadFreeBSD.h
  include/lldb/Host/linux/HostInfoLinux.h
  include/lldb/Host/linux/HostThreadLinux.h
  include/lldb/Host/macosx/HostThreadMacOSX.h
  include/lldb/Host/posix/HostThreadPosix.h
  include/lldb/Host/windows/HostThreadWindows.h
  include/lldb/Target/Process.h
  include/lldb/lldb-private-enumerations.h
  include/lldb/lldb-types.h
  lldb.xcodeproj/project.pbxproj
  source/API/SBHostOS.cpp
  source/Core/Communication.cpp
  source/Core/Debugger.cpp
  source/Core/Log.cpp
  source/Host/CMakeLists.txt
  source/Host/common/Host.cpp
  source/Host/common/HostInfoBase.cpp
  source/Host/common/HostThreadBase.cpp
  source/Host/common/ThisThread.cpp
  source/Host/common/ThreadRunner.cpp
  source/Host/freebsd/Host.cpp
  source/Host/freebsd/HostInfoFreeBSD.cpp
  source/Host/freebsd/HostThreadFreeBSD.cpp
  source/Host/freebsd/ThisThread.cpp
  source/Host/linux/Host.cpp
  source/Host/linux/HostInfoLinux.cpp
  source/Host/linux/HostThreadLinux.cpp
  source/Host/linux/ThisThread.cpp
  source/Host/macosx/Host.mm
  source/Host/macosx/HostThreadMacOSX.mm
  source/Host/macosx/ThisThread.cpp
  source/Host/posix/HostThreadPosix.cpp
  source/Host/windows/Host.cpp
  source/Host/windows/HostThreadWindows.cpp
  source/Host/windows/ThisThread.cpp
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
  source/Plugins/Process/FreeBSD/ProcessMonitor.h
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeThreadLinux.cpp
  source/Plugins/Process/Linux/ProcessMonitor.cpp
  source/Plugins/Process/Linux/ProcessMonitor.h
  source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
  source/Plugins/Process/POSIX/POSIXThread.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/Process.cpp
  tools/lldb-gdbserver/lldb-gdbserver.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5198.13284.patch
Type: text/x-patch
Size: 134499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140904/a200a6b4/attachment.bin>


More information about the lldb-commits mailing list