mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
[lldb] Resolve exe location for target create
This fixes an issue that, when you start lldb or use `target create`
with a program name which is on $PATH, or not specify the .exe suffix of
a program in the working directory on Windows, you get a confusing
error, for example:
(lldb) target create notepad
error: 'C:\WINDOWS\SYSTEM32\notepad.exe' doesn't contain any 'host'
platform architectures: i686, x86_64, i386, i386
Fixes https://github.com/mstorsjo/llvm-mingw/issues/265
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D127436
This commit is contained in:
committed by
Martin Storsjö
parent
8a64dd5b06
commit
2bae956057
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user