Author: David Spickett
Date: 2023-10-25T09:08:01+01:00
New Revision: a7700985577694d6cc2498833f27b4fb5eeaf252

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

LOG: [lldb][AArch64] Correct type of 32 bit GPR RegisterValues when using core 
files (#70054)

As ReadRegister always read into a uint64_t, when it called operator=
with uint64_t it was setting the RegisterValue's type to eTypeUInt64
regardless of its size.

This mostly works because most registers are 64 bit, and very few bits
of code rely on the type being correct. However, cpsr, fpsr and fpcr are
in fact 32 bit, and my upcoming register fields code relies on this type
being correct.

Which is how I found this bug and unfortunately is the only way to test
it. As RegisterValue::Type never makes it out via the API anywhere. So
this change will be tested once I start adding register field
information.

Added: 
    

Modified: 
    lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp

Removed: 
    


################################################################################
diff  --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
index 6f6c6d073939a61..f3e763b0475ceb1 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
@@ -184,11 +184,9 @@ bool RegisterContextCorePOSIX_arm64::ReadRegister(const 
RegisterInfo *reg_info,
 
   offset = reg_info->byte_offset;
   if (offset + reg_info->byte_size <= GetGPRSize()) {
-    uint64_t v = m_gpr_data.GetMaxU64(&offset, reg_info->byte_size);
-    if (offset == reg_info->byte_offset + reg_info->byte_size) {
-      value = v;
-      return true;
-    }
+    value.SetFromMemoryData(*reg_info, m_gpr_data.GetDataStart() + offset,
+                            reg_info->byte_size, lldb::eByteOrderLittle, 
error);
+    return error.Success();
   }
 
   const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to