[Lldb-commits] [lldb] r241340 - Fix 128bit register read and user register count on aarch64

Tamas Berghammer tberghammer at google.com
Fri Jul 3 04:17:07 PDT 2015


Author: tberghammer
Date: Fri Jul  3 06:17:07 2015
New Revision: 241340

URL: http://llvm.org/viewvc/llvm-project?rev=241340&view=rev
Log:
Fix 128bit register read and user register count on aarch64

Modified:
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp?rev=241340&r1=241339&r2=241340&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp Fri Jul  3 06:17:07 2015
@@ -193,6 +193,15 @@ NativeRegisterContextLinux_arm64::GetReg
     return nullptr;
 }
 
+uint32_t
+NativeRegisterContextLinux_arm64::GetUserRegisterCount() const
+{
+    uint32_t count = 0;
+    for (uint32_t set_index = 0; set_index < k_num_register_sets; ++set_index)
+        count += g_reg_sets_arm64[set_index].num_registers;
+    return count;
+}
+
 Error
 NativeRegisterContextLinux_arm64::ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value)
 {
@@ -242,22 +251,7 @@ NativeRegisterContextLinux_arm64::ReadRe
     // Get pointer to m_fpr variable and set the data from it.
     assert (reg_info->byte_offset < sizeof m_fpr);
     uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset;
-    switch (reg_info->byte_size)
-    {
-        case 2:
-            reg_value.SetUInt16(*(uint16_t *)src);
-            break;
-        case 4:
-            reg_value.SetUInt32(*(uint32_t *)src);
-            break;
-        case 8:
-            reg_value.SetUInt64(*(uint64_t *)src);
-            break;
-        default:
-            assert(false && "Unhandled data size.");
-            error.SetErrorStringWithFormat ("unhandled byte size: %" PRIu32, reg_info->byte_size);
-            break;
-    }
+    reg_value.SetFromMemoryData(reg_info, src, reg_info->byte_size, eByteOrderLittle, error);
 
     return error;
 }

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h?rev=241340&r1=241339&r2=241340&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h Fri Jul  3 06:17:07 2015
@@ -30,6 +30,9 @@ namespace process_linux {
         uint32_t
         GetRegisterSetCount () const override;
 
+        uint32_t
+        GetUserRegisterCount() const override;
+
         const RegisterSet *
         GetRegisterSet (uint32_t set_index) const override;
 





More information about the lldb-commits mailing list