[Lldb-commits] [PATCH] D113487: [lldb] Refactor Platform::ResolveExecutable

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 9 07:57:00 PST 2021


labath created this revision.
labath added reviewers: JDevlieghere, jingham, clayborg, PatriosTheGreat.
labath requested review of this revision.
Herald added a project: LLDB.

Module resolution is probably the most complex piece of lldb [citation
needed], with numerous levels of abstraction, each one implementing
various retry and fallback strategies.

It is also a very repetitive, with only small differences between
"host", "remote-and-connected" and "remote-but-not-(yet)-connected"
scenarios.

The goal of this patch (first in series) is to reduce the number of
abstractions, and deduplicate the code.

One of the reasons for this complexity is the tension between the desire
to offload the process of module resolution to the remote platform
instance (that's how most other platform methods work), and the desire
to keep it local to the outer platform class (its easier to subclass the
outer class, and it generally makes more sense).

This patch resolves that conflict in favour of doing everything in the
outer class. The gdb-remote (our only remote platform) implementation of
ResolveExecutable was not doing anything gdb-specific, and was rather
similar to the other implementations of that method (any divergence is
most likely the result of fixes not being applied everywhere rather than
intentional).

It does this by excising the remote platform out of the resolution
codepath. The gdb-remote implementation of ResolveExecutable is moved to
Platform::ResolveRemoteExecutable, and the (only) call site is
redirected to that. On its own, this does not achieve (much), but it
creates new opportunities for layer peeling and code sharing, since all
of the code now lives closer together.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113487

Files:
  lldb/include/lldb/Target/Platform.h
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  lldb/source/Target/Platform.cpp
  lldb/source/Target/RemoteAwarePlatform.cpp
  lldb/unittests/Target/RemoteAwarePlatformTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113487.385828.patch
Type: text/x-patch
Size: 14222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211109/909a19a1/attachment-0001.bin>


More information about the lldb-commits mailing list