summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2018-01-12 01:16:13 +0000
committerJason Molenda <jmolenda@apple.com>2018-01-12 01:16:13 +0000
commitc4dd04c5c3077b311532d61fda256590aa96ee0c (patch)
treeea6a48ea81c1af74a12d36a9685d26a09bc6f9fd
parente38b018df4c4524cda9f61cedfe5a8ab551c6e93 (diff)
downloadbcm5719-llvm-c4dd04c5c3077b311532d61fda256590aa96ee0c.tar.gz
bcm5719-llvm-c4dd04c5c3077b311532d61fda256590aa96ee0c.zip
When parsing the target.xml register file, if no architecture has
been specified yet (either by the user, or by one of the lldb extensions like qHostInfo or qProcessInfo), and the target.xml includes a <architecture> tag specifying x86_64, set the architecture appropriately. I'm not sure what we can expect to see in the <architecture> tag, so I'm only doing this for x86_64 right now where I've seen "i386:x86_64" used. I've seen a target.xml from a jtag board that sends just "arm" because it doesn't know more specifically what type of board it is connected to... <rdar://problem/29908970> llvm-svn: 322339
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp13
-rw-r--r--lldb/tools/debugserver/source/RNBRemote.cpp7
2 files changed, 20 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 78399b733a7..36052658bec 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4400,6 +4400,19 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) {
return true; // Keep iterating through all children of the target_node
});
+ // If the target.xml includes an architecture entry like
+ // <architecture>i386:x86-64</architecture> (seen from VMWare ESXi)
+ // <architecture>arm</architecture> (seen from Segger JLink on unspecified arm board)
+ // use that if we don't have anything better.
+ 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);
+ }
+ }
+
// Initialize these outside of ParseRegisters, since they should not be
// reset inside each include feature
uint32_t cur_reg_num = 0;
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index 0a2eef3feac..cba00052d80 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4981,6 +4981,13 @@ void UpdateTargetXML() {
s << g_target_xml_header << std::endl;
// Set the architecture
+ //
+ // On raw targets (no OS, vendor info), I've seen replies like
+ // <architecture>i386:x86-64</architecture> (for x86_64 systems - from vmware)
+ // <architecture>arm</architecture> (for an unspecified arm device - from a Segger JLink)
+ // For good interop, I'm not sure what's expected here. e.g. will anyone understand
+ // <architecture>x86_64</architecture> ? Or is i386:x86_64 the expected phrasing?
+ //
// s << "<architecture>" << arch "</architecture>" << std::endl;
// Set the OSABI
OpenPOWER on IntegriCloud