[Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 10 04:56:56 PST 2018


labath created this revision.
labath added reviewers: jingham, clayborg.
Herald added a subscriber: emaste.

These were used by Host::LaunchProcess to "resolve" the executable it
was about to launch. The only parts of Platform::ResolveExecutable, which
seem to be relevant here are the FileSpec::ResolvePath and
ResolveExecutableLocation calls.

The rest (most) of that function deals with selecting an architecture
out of a fat binary and making sure we are able to create a Module with that
slice. These are reasonable actions when selecting a binary to debug,
but not for a generic process launching framework (it's technically even
wrong because we should be able to launch a binary with execute
permissions only, but trying to parse such file will obviously fail).

I remove the platform call by inlining the relevant FileSpec calls and
ignoring the rest of the Platform::ResolveExecutable code.  The
architecture found by the slice-searching code is being ignored already
anyway, as we use the one specified in the LaunchInfo, so the only
effect of this should be a different error message in case the
executable does not contain the requested architecture -- before we
would get an error message from the Platform class, but now we will get
an error from the actual posix_spawn syscall (this is only relevant on
mac, as it's the only target supporting fat binaries).

Launching targets for debugging should not be affected as here the
executable is pre-resolved at the point when the Target is created.


https://reviews.llvm.org/D41902

Files:
  source/Host/common/MonitoringProcessLauncher.cpp
  source/Host/freebsd/Host.cpp
  source/Host/macosx/Host.mm
  source/Host/netbsd/Host.cpp
  source/Host/openbsd/Host.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41902.129248.patch
Type: text/x-patch
Size: 6389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180110/45fcabf2/attachment.bin>


More information about the lldb-commits mailing list