[Lldb-commits] [PATCH] D34400: Move Connection from Core to Host

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 20 07:00:28 PDT 2017

On 20 June 2017 at 14:28, Zachary Turner <zturner at google.com> wrote:
> I had actually been considering going the other way. Moving connection and
> all implementations to Utility. Host is a big contributor to the dependency
> problems, so putting more stuff in seems like the wrong direction.

Well, I'd say that Core is an even bigger contributor to the cycles
than Host (e.g. it has Timer.cpp, which depends on nothing, and
Debugger.cpp, which depends on everything). With this, I was looking
at breaking the Host->Core dependency. After this patch the only Core
files which are included from Host are:

Of these, only the Module dependency worries me (but I haven't yet
looked at why exactly it's needed) -- I believe all the others can be
solved fairly easily by moving the relevant files to Host or Utility.

> The end state i had in mind was similar to llvm support (which is more less
> the equivalent of lldb host), where it has all the host specific
> functionality but contains no deps.
> With that in mind, thoughts on moving everything to Utility?

I am not categorically against it, but it's not my preferred solution
either. For example, if we were to move Connection there now, it would
require at least moving all of the socket library and pipes which is a
large chunk of host-specific code. I like how currently we have this
separation where Utility contains some fairly generic classes and
algorithms, and Host contains things for interfacing with the host
system (which tends to be ugly and full of ifdefs -- I'd like to avoid
ifdefs in Utlity if at all possible).

I realize it's possible I may run into a wall with this philosophy,
but I'd like to try and give it a go. I think the fact that we have
the llvm support library under us, where we can hide a lot of the
non-debugger-specific host code, means that there is a fair chance
this could succeed.

> On Tue, Jun 20, 2017 at 5:56 AM Pavel Labath via Phabricator
> <reviews at reviews.llvm.org> wrote:
>> labath created this revision.
>> Herald added a subscriber: mgorny.
>> All implementations of the connection interface live in the Host module
>> already, so it makes sense for the interface itself to be defined there.
>> https://reviews.llvm.org/D34400
>> Files:
>>   include/lldb/Core/Connection.h
>>   include/lldb/Host/Connection.h
>>   include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
>>   include/lldb/Host/windows/ConnectionGenericFileWindows.h
>>   source/Core/CMakeLists.txt
>>   source/Core/Communication.cpp
>>   source/Core/Connection.cpp
>>   source/Host/CMakeLists.txt
>>   source/Host/common/Connection.cpp
>>   source/Host/posix/ConnectionFileDescriptorPosix.cpp
>>   tools/lldb-server/Acceptor.h

More information about the lldb-commits mailing list