[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 02:22:23 PDT 2021


mgorny updated this revision to Diff 369048.
mgorny added a comment.

Also updated the comments in `struct RegisterInfo` to indicate what kind of numbers go in these arrays.


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

https://reviews.llvm.org/D108768

Files:
  lldb/include/lldb/lldb-private-types.h
  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("]");
     }
Index: lldb/include/lldb/lldb-private-types.h
===================================================================
--- lldb/include/lldb/lldb-private-types.h
+++ lldb/include/lldb/lldb-private-types.h
@@ -51,12 +51,13 @@
   /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
   /// not null, all registers in this list will be read first, at which point
   /// the value for this register will be valid. For example, the value list
-  /// for ah would be eax (x86) or rax (x64).
-  uint32_t *value_regs; //
+  /// for ah would be eax (x86) or rax (x64). Register numbers are
+  /// of eRegisterKindProcessPlugin.
+  uint32_t *value_regs;
   /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
   /// not null, all registers in this list will be invalidated when the value of
   /// this register changes. For example, the invalidate list for eax would be
-  /// rax ax, ah, and al.
+  /// rax ax, ah, and al. Register numbers are of eRegisterKindProcessPlugin.
   uint32_t *invalidate_regs;
   /// A DWARF expression that when evaluated gives the byte size of this
   /// register.


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


More information about the lldb-commits mailing list