[Lldb-commits] [lldb] be88462 - Platform qemu-user: Build path to qemu automatically if not specified
Ted Woodward via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 22 12:20:33 PDT 2023
Author: Ted Woodward
Date: 2023-08-22T14:20:18-05:00
New Revision: be88462cd6aa819c22185ff0916988d4f03b6ab0
URL: https://github.com/llvm/llvm-project/commit/be88462cd6aa819c22185ff0916988d4f03b6ab0
DIFF: https://github.com/llvm/llvm-project/commit/be88462cd6aa819c22185ff0916988d4f03b6ab0.diff
LOG: Platform qemu-user: Build path to qemu automatically if not specified
Get the path to qemu in the following order:
1) From the property platform.plugin.qemu-user.emulator-path
2) If that property is not set, from PATH, building the name of the qemu
binary from the triple in property platform.plugin.qemu-user.architecture
3) If that property is not set, from PATH, building the name of the qemu
binary from the triple in the target
This will allow a user to load a target and run without setting properties,
if qemu is on the PATH and named qemu-<ArchName>
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D155117
Added:
Modified:
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 72a039d18872758..b233b1ba9b5899c 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -162,9 +162,18 @@ lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
Target &target, Status &error) {
Log *log = GetLog(LLDBLog::Platform);
+ // If platform.plugin.qemu-user.emulator-path is set, use it.
FileSpec qemu = GetGlobalProperties().GetEmulatorPath();
- if (!qemu)
- qemu.SetPath(("qemu-" + GetGlobalProperties().GetArchitecture()).str());
+ // If platform.plugin.qemu-user.emulator-path is not set, build the
+ // executable name from platform.plugin.qemu-user.architecture.
+ if (!qemu) {
+ llvm::StringRef arch = GetGlobalProperties().GetArchitecture();
+ // If platform.plugin.qemu-user.architecture is not set, build the
+ // executable name from the target Triple's ArchName
+ if (arch.empty())
+ arch = target.GetArchitecture().GetTriple().getArchName();
+ qemu.SetPath(("qemu-" + arch).str());
+ }
FileSystem::Instance().ResolveExecutableLocation(qemu);
llvm::SmallString<0> socket_model, socket_path;
More information about the lldb-commits
mailing list