HomePhabricator

Introduce a MainLoop class and switch llgs to use it
AuditedrL242018

Description

Introduce a MainLoop class and switch llgs to use it

Summary:
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.

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.

Reviewers: ovyalov, clayborg, amccarth, zturner, emaste

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D11066

Details

Auditors
chaoren
Committed
labathJul 13 2015, 3:44 AM
Differential Revision
D11066: Introduce a MainLoop class and switch llgs to use it
Parents
rL242017: Skip oatdata and oatexec symbols in system@framework@boot.oat
Branches
Unknown
Tags
Unknown

Event Timeline

chaoren raised a concern with this commit.Jul 16 2015, 6:55 PM
chaoren added a subscriber: chaoren.
chaoren added inline comments.
/lldb/trunk/source/Host/posix/MainLoopPosix.cpp
101

This assert fails when running TestThreadStates.py against a Nexus Player. Could you please take a look at this? (Might be responsible for the test hanging on Windows.)

llvm/tools/lldb/source/Host/posix/MainLoopPosix.cpp:101: virtual void lldb_private::MainLoopPosix::UnregisterReadObject(const IOObjectSP&): assertion "erased" failed

I've submitted a fix for this in r242515. I don't suspect it will address the problem with the hanging test, as the assertion was hit after the connection was closed, but do give it a look.

chaoren accepted this commit.Jul 17 2015, 12:11 PM