[Lldb-commits] [PATCH] D135671: [LLDB] Change RegisterValue::SetType param to const RegisterInfo&

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 11 07:09:05 PDT 2022


DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

No one was pasing nullptr here.

Depends on D135670 <https://reviews.llvm.org/D135670>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135671

Files:
  lldb/include/lldb/Utility/RegisterValue.h
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
  lldb/source/Utility/RegisterValue.cpp


Index: lldb/source/Utility/RegisterValue.cpp
===================================================================
--- lldb/source/Utility/RegisterValue.cpp
+++ lldb/source/Utility/RegisterValue.cpp
@@ -149,13 +149,12 @@
 
 void RegisterValue::Clear() { m_type = eTypeInvalid; }
 
-RegisterValue::Type RegisterValue::SetType(const RegisterInfo *reg_info) {
-  assert(reg_info && "Expected non null reg_info.");
+RegisterValue::Type RegisterValue::SetType(const RegisterInfo &reg_info) {
   // To change the type, we simply copy the data in again, using the new format
   RegisterValue copy;
   DataExtractor copy_data;
   if (copy.CopyValue(*this) && copy.GetData(copy_data)) {
-    Status error = SetValueFromData(*reg_info, copy_data, 0, true);
+    Status error = SetValueFromData(reg_info, copy_data, 0, true);
     assert(error.Success() && "Expected SetValueFromData to succeed.");
     UNUSED_IF_ASSERT_DISABLED(error);
   }
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
===================================================================
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -136,7 +136,7 @@
       // then use the type specified by reg_info rather than the uint64_t
       // default
       if (reg_value.GetByteSize() > reg_info->byte_size)
-        reg_value.SetType(reg_info);
+        reg_value.SetType(*reg_info);
     }
     return error;
   }
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
===================================================================
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
@@ -75,7 +75,7 @@
         memcpy(dst + (reg_info->byte_offset & 0x1), src, src_size);
         // Set this full register as the value to write.
         value_to_write.SetBytes(dst, full_value.GetByteSize(), byte_order);
-        value_to_write.SetType(full_reg_info);
+        value_to_write.SetType(*full_reg_info);
         reg_to_write = full_reg;
       }
     }
Index: lldb/include/lldb/Utility/RegisterValue.h
===================================================================
--- lldb/include/lldb/Utility/RegisterValue.h
+++ lldb/include/lldb/Utility/RegisterValue.h
@@ -84,7 +84,7 @@
 
   void SetType(RegisterValue::Type type) { m_type = type; }
 
-  RegisterValue::Type SetType(const RegisterInfo *reg_info);
+  RegisterValue::Type SetType(const RegisterInfo &reg_info);
 
   bool GetData(DataExtractor &data) const;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135671.466808.patch
Type: text/x-patch
Size: 2610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221011/d630b7ba/attachment.bin>


More information about the lldb-commits mailing list