[Lldb-commits] [lldb] 28e65a6 - [LLDB] Change RegisterValue::SetType param to const RegisterInfo&

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 12 01:25:25 PDT 2022


Author: David Spickett
Date: 2022-10-12T08:25:14Z
New Revision: 28e65a6a63ab39be97d1a88fe7b4d0fa2f532643

URL: https://github.com/llvm/llvm-project/commit/28e65a6a63ab39be97d1a88fe7b4d0fa2f532643
DIFF: https://github.com/llvm/llvm-project/commit/28e65a6a63ab39be97d1a88fe7b4d0fa2f532643.diff

LOG: [LLDB] Change RegisterValue::SetType param to const RegisterInfo&

No one was pasing nullptr here.

Depends on D135670

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D135671

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Utility/RegisterValue.h b/lldb/include/lldb/Utility/RegisterValue.h
index 3a3c0a07f8f4c..ff3dc9b3dda42 100644
--- a/lldb/include/lldb/Utility/RegisterValue.h
+++ b/lldb/include/lldb/Utility/RegisterValue.h
@@ -84,7 +84,7 @@ class RegisterValue {
 
   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;
 

diff  --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
index 146e33ff43b20..9af795f228290 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
@@ -75,7 +75,7 @@ NativeRegisterContextLinux::WriteRegisterRaw(uint32_t reg_index,
         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;
       }
     }

diff  --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
index 8d4585a02a8c3..5ad2f7a8e9455 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -136,7 +136,7 @@ NativeRegisterContextLinux_arm::ReadRegister(const RegisterInfo *reg_info,
       // 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;
   }

diff  --git a/lldb/source/Utility/RegisterValue.cpp b/lldb/source/Utility/RegisterValue.cpp
index f1d37b0e0cbe9..b9ce9fd18ac48 100644
--- a/lldb/source/Utility/RegisterValue.cpp
+++ b/lldb/source/Utility/RegisterValue.cpp
@@ -149,13 +149,12 @@ bool RegisterValue::GetScalarValue(Scalar &scalar) const {
 
 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);
   }


        


More information about the lldb-commits mailing list