aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/contrib/llvm-project/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 72a039d18872..460f5560573d 100644
--- a/contrib/llvm-project/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/contrib/llvm-project/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -36,7 +36,7 @@ class PluginProperties : public Properties {
public:
PluginProperties() {
m_collection_sp = std::make_shared<OptionValueProperties>(
- ConstString(PlatformQemuUser::GetPluginNameStatic()));
+ PlatformQemuUser::GetPluginNameStatic());
m_collection_sp->Initialize(g_platformqemuuser_properties);
}
@@ -89,8 +89,8 @@ void PlatformQemuUser::Terminate() {
}
void PlatformQemuUser::DebuggerInitialize(Debugger &debugger) {
- if (!PluginManager::GetSettingForPlatformPlugin(
- debugger, ConstString(GetPluginNameStatic()))) {
+ if (!PluginManager::GetSettingForPlatformPlugin(debugger,
+ GetPluginNameStatic())) {
PluginManager::CreateSettingForPlatformPlugin(
debugger, GetGlobalProperties().GetValueProperties(),
"Properties for the qemu-user platform plugin.",
@@ -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;