[Lldb-commits] [PATCH] D11066: Introduce a MainLoop class and switch llgs to use it

Pavel Labath labath at google.com
Thu Jul 9 09:32:33 PDT 2015


labath created this revision.
labath added reviewers: ovyalov, clayborg, amccarth, zturner, emaste.
labath added a subscriber: lldb-commits.
Herald added a subscriber: tberghammer.

This is the first part of our effort to make llgs single threaded. Currently, llgs consists of
about three threads and the synchronisation between them is a major source of latency when
debugging linux and android applications.

In order to be able to go single threaded, we must have the ability to listen for events from
multiple sources (primarily, client commands coming over the network and debug events from the
inferior) and perform necessary actions. For this reason I introduce the concept of a MainLoop.
A main loop has the ability to register callback's which will be invoked upon receipt of certain
events. MainLoopPosix has the ability to listen for file descriptors and signals. I have also
introduced a stubbed-out implementation of MainLoopWindows, which was necessary to make code
compile on windows (this does not introduce any regression as the llgs component is not used on
windows). It is my hope that if can get a windows implementation of this class, we could
gradually replace the uses of select in lldb (which are currently #ifdefed for windows) with
MainLoop invocations.

For the moment, I have merely made the GDBRemoteCommunicationServerLLGS class use MainLoop
instead of waiting on the network socket directly, but the other threads still remain. In the
followup patches I indend to migrate NativeProcessLinux to this class and remove the remaining
threads.

http://reviews.llvm.org/D11066

Files:
  include/lldb/Core/Connection.h
  include/lldb/Host/MainLoop.h
  include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
  include/lldb/Host/posix/MainLoopPosix.h
  include/lldb/Host/windows/MainLoopWindows.h
  lldb.xcodeproj/project.pbxproj
  source/Host/CMakeLists.txt
  source/Host/posix/MainLoopPosix.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  tools/lldb-server/lldb-gdbserver.cpp
  tools/lldb-server/lldb-platform.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11066.29342.patch
Type: text/x-patch
Size: 29761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150709/31a0af58/attachment.bin>


More information about the lldb-commits mailing list