[Lldb-commits] [PATCH] D109879: [lldb] [DynamicRegisterInfo] Update RegisterInfo with copy of value_regs/invalidate_regs

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 16 06:15:02 PDT 2021


mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste.
mgorny requested review of this revision.

Update the value_regs and invalidate_regs pointers in RegisterInfo
to use the copy made by DynamicRegisterInfo.  This permits passing
temporaries as value_regs and invalidate_regs to
DynamicregisterInfo::AddRegister().


https://reviews.llvm.org/D109879

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
@@ -402,12 +402,22 @@
   assert(reg_info.name);
   uint32_t i;
   if (reg_info.value_regs) {
-    for (i = 0; reg_info.value_regs[i] != LLDB_INVALID_REGNUM; ++i)
-      m_value_regs_map[reg_num].push_back(reg_info.value_regs[i]);
+    reg_num_collection &regs = m_value_regs_map[reg_num];
+    for (i = 0;; ++i) {
+      regs.push_back(reg_info.value_regs[i]);
+      if (reg_info.value_regs[i] == LLDB_INVALID_REGNUM)
+        break;
+    }
+    reg_info.value_regs = regs.data();
   }
   if (reg_info.invalidate_regs) {
-    for (i = 0; reg_info.invalidate_regs[i] != LLDB_INVALID_REGNUM; ++i)
-      m_invalidate_regs_map[reg_num].push_back(reg_info.invalidate_regs[i]);
+    reg_num_collection &regs = m_invalidate_regs_map[reg_num];
+    for (i = 0;; ++i) {
+      regs.push_back(reg_info.invalidate_regs[i]);
+      if (reg_info.invalidate_regs[i] == LLDB_INVALID_REGNUM)
+        break;
+    }
+    reg_info.invalidate_regs = regs.data();
   }
   if (reg_info.dynamic_size_dwarf_expr_bytes) {
     for (i = 0; i < reg_info.dynamic_size_dwarf_len; ++i)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109879.372914.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210916/df097a7f/attachment.bin>


More information about the lldb-commits mailing list