aboutsummaryrefslogtreecommitdiff
path: root/lldb/source
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2021-12-30 15:02:23 +0100
committerPavel Labath <pavel@labath.sk>2021-12-30 15:14:41 +0100
commit9b8f9d33dbbcd6525ab4d582cb9abb6f98e3601c (patch)
tree8295b078bbea4effdc73435de4ffaf716c01fc83 /lldb/source
parente5e844b37e75efb5528b8b410f1590bf2c913bc7 (diff)
downloadllvm-9b8f9d33dbbcd6525ab4d582cb9abb6f98e3601c.tar.gz
llvm-9b8f9d33dbbcd6525ab4d582cb9abb6f98e3601c.tar.bz2
llvm-9b8f9d33dbbcd6525ab4d582cb9abb6f98e3601c.zip
[lldb/qemu] More flexible emulator specification
This small patch adds two useful improvements: - allows one to specify the emulator path as a bare filename, and have it be looked up in the PATH - allows one to leave the path empty and have the filename be derived from the architecture.
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp7
-rw-r--r--lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td2
2 files changed, 6 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 67c9484680a4..572a5b39985e 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -162,7 +162,10 @@ lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
Target &target, Status &error) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
- std::string qemu = GetGlobalProperties().GetEmulatorPath().GetPath();
+ FileSpec qemu = GetGlobalProperties().GetEmulatorPath();
+ if (!qemu)
+ qemu.SetPath(("qemu-" + GetGlobalProperties().GetArchitecture()).str());
+ FileSystem::Instance().ResolveExecutableLocation(qemu);
llvm::SmallString<0> socket_model, socket_path;
HostInfo::GetProcessTempDir().GetPath(socket_model);
@@ -171,7 +174,7 @@ lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
llvm::sys::fs::createUniquePath(socket_model, socket_path, false);
} while (FileSystem::Instance().Exists(socket_path));
- Args args({qemu, "-g", socket_path});
+ Args args({qemu.GetPath(), "-g", socket_path});
args.AppendArguments(GetGlobalProperties().GetEmulatorArgs());
args.AppendArgument("--");
args.AppendArgument(launch_info.GetExecutableFile().GetPath());
diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
index 4e8fbcfd6760..c7ec4bbc6e78 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
@@ -8,7 +8,7 @@ let Definition = "platformqemuuser" in {
def EmulatorPath: Property<"emulator-path", "FileSpec">,
Global,
DefaultStringValue<"">,
- Desc<"Path to the emulator binary.">;
+ Desc<"Path to the emulator binary. If the path does not contain a directory separator, the filename is looked up in the PATH environment variable. If empty, the filename is derived from the architecture setting.">;
def EmulatorArgs: Property<"emulator-args", "Args">,
Global,
DefaultStringValue<"">,