aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectTarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 7789698..23ebbdb 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -299,12 +299,6 @@ protected:
const char *file_path = command.GetArgumentAtIndex(0);
LLDB_SCOPED_TIMERF("(lldb) target create '%s'", file_path);
- FileSpec file_spec;
-
- if (file_path) {
- file_spec.SetFile(file_path, FileSpec::Style::native);
- FileSystem::Instance().Resolve(file_spec);
- }
bool must_set_platform_path = false;
@@ -333,6 +327,18 @@ protected:
PlatformSP platform_sp = target_sp->GetPlatform();
+ FileSpec file_spec;
+ if (file_path) {
+ file_spec.SetFile(file_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(file_spec);
+
+ // Try to resolve the exe based on PATH and/or platform-specific
+ // suffixes, but only if using the host platform.
+ if (platform_sp && platform_sp->IsHost() &&
+ !FileSystem::Instance().Exists(file_spec))
+ FileSystem::Instance().ResolveExecutableLocation(file_spec);
+ }
+
if (remote_file) {
if (platform_sp) {
// I have a remote file.. two possible cases