[Lldb-commits] [lldb] r322339 - When parsing the target.xml register file, if no architecture has

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 11 17:16:13 PST 2018


Author: jmolenda
Date: Thu Jan 11 17:16:13 2018
New Revision: 322339

URL: http://llvm.org/viewvc/llvm-project?rev=322339&view=rev
Log:
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> 


Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=322339&r1=322338&r2=322339&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Jan 11 17:16:13 2018
@@ -4400,6 +4400,19 @@ bool ProcessGDBRemote::GetGDBServerRegis
         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;

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=322339&r1=322338&r2=322339&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Thu Jan 11 17:16:13 2018
@@ -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




More information about the lldb-commits mailing list