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

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 20 08:47:52 PDT 2017


I do think at some point we will need to break up Host, but whether the
best way is to move stuff into Utility or to somewhere else is an open
question. Host also depends on Target, Symbol, process plugins, and various
other things. So we will need a way to group together all the stuff in Host
that has no other dependencies. This could then remove the dependency from
X -> Host for many values of X.

I agree that Core is bigger, but unfortunately with deps it's kind of all
or nothing. You don't see any benefit from removing 99 if there's still 1
more.

If you don't want to do it now that's fine as it does indeed require moving
many other things, but moving it to Host seems like a lateral move at best
- nothing gained nothing lost. What about moving the base class to Utility?
At least then you wouldn't need to link Host to use Connection, which could
encourage a factory-like pattern
On Tue, Jun 20, 2017 at 7:00 AM Pavel Labath <labath at google.com> wrote:

> 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:
> Core/ArchSpec.h
> Core/Communication.h
> Core/Module.h
> Core/ModuleSpec.h
> Core/RegisterValue.h
> Core/State.h
> Core/StreamFile.h
> Core/StructuredData.h
> Core/Timer.h
> Core/TraceOptions.h
>
> 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
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170620/c81fa5a4/attachment-0001.html>


More information about the lldb-commits mailing list