[Lldb-commits] [lldb] r240768 - XML register info fix

Ewan Crawford ewan at codeplay.com
Fri Jun 26 02:38:28 PDT 2015


Author: ewancrawford
Date: Fri Jun 26 04:38:27 2015
New Revision: 240768

URL: http://llvm.org/viewvc/llvm-project?rev=240768&view=rev
Log:
XML register info fix

There are a couple of bugs in the XML register info handling which this patch fixes:

+ conflicting variable names in lambda, both capture list and parameters contains a variable called 'name'.

+ prev_reg_num, which sets the register number, should be incremented after each register is processed.

+ Windows errors regarding empty strings and the 'xi:' prefix disappearing from 'xi:include' node name.

Reviewers: clayborg

Subscribers: lldb-commits, deepak2427

Differential Revision: http://reviews.llvm.org/D10731

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=240768&r1=240767&r2=240768&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Jun 26 04:38:27 2015
@@ -4224,8 +4224,8 @@ GDBRemoteCommunicationClient::ReadExtFea
         // send query extended feature packet
         std::stringstream packet;
         packet << "qXfer:" 
-               << object.AsCString( ) << ":read:" 
-               << annex.AsCString( )  << ":" 
+               << object.AsCString("") << ":read:" 
+               << annex.AsCString("")  << ":" 
                << std::hex << offset  << "," 
                << std::hex << size;
 

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=240768&r1=240767&r2=240768&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Jun 26 04:38:27 2015
@@ -3969,7 +3969,6 @@ ParseRegisters (XMLNode feature_node, Gd
     uint32_t reg_offset = 0;
 
     feature_node.ForEachChildElementWithName("reg", [&target_info, &dyn_reg_info, &prev_reg_num, &reg_offset](const XMLNode &reg_node) -> bool {
-        std::string name;
         std::string gdb_group;
         std::string gdb_type;
         ConstString reg_name;
@@ -3996,7 +3995,7 @@ ParseRegisters (XMLNode feature_node, Gd
             NULL
         };
         
-        reg_node.ForEachAttribute([&target_info, &name, &gdb_group, &gdb_type, &reg_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, &format_set, &reg_info, &prev_reg_num, &reg_offset](const llvm::StringRef &name, const llvm::StringRef &value) -> bool {
+        reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, &reg_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, &format_set, &reg_info, &prev_reg_num, &reg_offset](const llvm::StringRef &name, const llvm::StringRef &value) -> bool {
             if (name == "name")
             {
                 reg_name.SetString(value);
@@ -4131,6 +4130,7 @@ ParseRegisters (XMLNode feature_node, Gd
             reg_info.invalidate_regs = invalidate_regs.data();
         }
         
+        ++prev_reg_num;
         dyn_reg_info.AddRegister(reg_info, reg_name, alt_name, set_name);
         
         return true; // Keep iterating through all "reg" elements
@@ -4192,7 +4192,7 @@ ProcessGDBRemote::GetGDBServerRegisterIn
                 {
                     node.GetElementText(target_info.osabi);
                 }
-                else if (name == "xi:include")
+                else if (name == "xi:include" || name == "include")
                 {
                     llvm::StringRef href = node.GetAttributeValue("href");
                     if (!href.empty())





More information about the lldb-commits mailing list