Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4661,24 +4661,22 @@
}
}
- // If the target.xml includes an architecture entry like
+ // gdbserver does not implement the LLDB packets used to determine host
+ // or process architecture. If that is the case, attempt to use
+ // the field from target.xml, e.g.:
+ //
// i386:x86-64 (seen from VMWare ESXi)
- // arm (seen from Segger JLink on unspecified arm board)
- // use that if we don't have anything better.
+ // arm (seen from Segger JLink on unspecified
+ // arm board)
if (!arch_to_use.IsValid() && !target_info.arch.empty()) {
- if (target_info.arch == "i386:x86-64") {
- // We don't have any information about vendor or OS.
- arch_to_use.SetTriple("x86_64--");
- GetTarget().MergeArchitecture(arch_to_use);
- }
+ // We don't have any information about vendor or OS.
+ arch_to_use.SetTriple(llvm::StringSwitch(target_info.arch)
+ .Case("i386:x86-64", "x86_64")
+ .Default(target_info.arch) +
+ "--");
- // SEGGER J-Link jtag boards send this very-generic arch name,
- // we'll need to use this if we have absolutely nothing better
- // to work with or the register definitions won't be accepted.
- if (target_info.arch == "arm") {
- arch_to_use.SetTriple("arm--");
+ if (arch_to_use.IsValid())
GetTarget().MergeArchitecture(arch_to_use);
- }
}
if (arch_to_use.IsValid()) {