[Lldb-commits] [PATCH] D33778: Add a NativeProcessProtocol Factory class

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 1 07:21:05 PDT 2017


labath created this revision.
Herald added subscribers: mgorny, srhines.

This replaces the static functions used for creating
NativeProcessProtocol instances with a factory pattern, and modernizes
the interface of the new class in the process -- I use llvm::Expected
instead of the Status+value combo. I also move some of the common code
(like the Delegate registration into the base class). The new
arrangement has multiple benefits:

- it removes the NativeProcess*** dependency from Process/gdb-remote (which for example means that liblldb no longer pulls in this code).
- it enables unit testing of the GDBRemoteCommunicationServerLLGS class (by providing a mock Native Process).
- serves as another example on how to use the llvm::Expected class (I couldn't get rid of the Initialize-type functions completely here because of the use of shared_from_this, but that's the next thing on my list here)

Tests still pass on Linux and I've made sure NetBSD compiles after this.


https://reviews.llvm.org/D33778

Files:
  include/lldb/Host/common/NativeProcessProtocol.h
  source/Host/common/NativeProcessProtocol.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/gdb-remote/CMakeLists.txt
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  tools/lldb-server/CMakeLists.txt
  tools/lldb-server/lldb-gdbserver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33778.101022.patch
Type: text/x-patch
Size: 50569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170601/ea8d902d/attachment-0001.bin>


More information about the lldb-commits mailing list