[Lldb-commits] [PATCH] XML register info fix

Ewan Crawford ewan at codeplay.com
Thu Jun 25 05:21:46 PDT 2015


Hi clayborg,

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.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10731

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -4197,8 +4197,8 @@
         // 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;
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3761,7 +3761,6 @@
     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;
@@ -3788,7 +3787,7 @@
             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);
@@ -3923,6 +3922,7 @@
             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
@@ -3984,7 +3984,7 @@
                 {
                     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())

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10731.28449.patch
Type: text/x-patch
Size: 2636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150625/152fe8c8/attachment.bin>


More information about the lldb-commits mailing list