[Lldb-commits] [PATCH] D35123: Remove shared pointer from NativeProcessProtocol

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 7 06:56:59 PDT 2017


labath created this revision.

The usage of shared_from_this forces us to separate construction and
initialization phases, because shared_from_this() is not available in
the constructor (or destructor). The shared semantics are not necessary,
as we always have a clear owner of the native process class
(GDBRemoteCommunicationServerLLDB object). Even if we need shared
semantics in the future (which I think we should strongly avoid),
reverting this will not be necessary -- the owners can still easily
store the native process object in a shared pointer if they really want
to -- this just prevents the knowledge of that from leaking into the
class implementation.

After this a NativeThread object will hold a reference to the parent
process (instead of a weak_ptr) -- having a process instance always
available allows us to simplify some logic in this class (some of it was
already simplified because we were asserting that the process is
available, but this makes it obvious).


https://reviews.llvm.org/D35123

Files:
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/Host/common/NativeThreadProtocol.h
  include/lldb/lldb-private-forward.h
  source/Host/common/NativeRegisterContext.cpp
  source/Host/common/NativeThreadProtocol.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.h
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  tools/lldb-server/lldb-gdbserver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35123.105637.patch
Type: text/x-patch
Size: 74640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170707/c6660c3c/attachment-0001.bin>


More information about the lldb-commits mailing list