[Lldb-commits] [PATCH] D108768: [lldb] DynamicRegisterInfo: fix wrong regnos in Dump()

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 27 01:21:38 PDT 2021


mgorny updated this revision to Diff 369042.
mgorny retitled this revision from "[lldb] [DynamicRegisterInfo] Fix mistaken reg type when calculating offsets" to "[lldb] DynamicRegisterInfo: fix wrong regnos in Dump()".
mgorny edited the summary of this revision.
mgorny added a comment.

So I've given it some thought and found a simple fix.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108768/new/

https://reviews.llvm.org/D108768

Files:
  lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp


Index: lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
===================================================================
--- lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -775,7 +775,12 @@
     if (m_regs[i].value_regs) {
       s.Printf(", value_regs = [ ");
       for (size_t j = 0; m_regs[i].value_regs[j] != LLDB_INVALID_REGNUM; ++j) {
-        s.Printf("%s ", m_regs[m_regs[i].value_regs[j]].name);
+        const RegisterInfo *value_reg = GetRegisterInfo(
+            eRegisterKindProcessPlugin, m_regs[i].value_regs[j]);
+        if (value_reg)
+          s.Printf("%s ", value_reg->name);
+        else
+          s.Printf("(%d) ", m_regs[i].value_regs[j]);
       }
       s.Printf("]");
     }
@@ -783,7 +788,12 @@
       s.Printf(", invalidate_regs = [ ");
       for (size_t j = 0; m_regs[i].invalidate_regs[j] != LLDB_INVALID_REGNUM;
            ++j) {
-        s.Printf("%s ", m_regs[m_regs[i].invalidate_regs[j]].name);
+        const RegisterInfo *invalidate_reg = GetRegisterInfo(
+            eRegisterKindProcessPlugin, m_regs[i].invalidate_regs[j]);
+        if (invalidate_reg)
+          s.Printf("%s ", invalidate_reg->name);
+        else
+          s.Printf("(%d) ", m_regs[i].invalidate_regs[j]);
       }
       s.Printf("]");
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108768.369042.patch
Type: text/x-patch
Size: 1358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210827/563531e4/attachment.bin>


More information about the lldb-commits mailing list