[Lldb-commits] [lldb] b595137 - [LLDB] Fix Cpsr size for WoA64 target

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 4 05:44:13 PDT 2021


Author: Muhammad Omair Javaid
Date: 2021-11-04T17:43:31+05:00
New Revision: b595137fe1c06c6fd72ad3c5b30a7750eeca07c1

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

LOG: [LLDB] Fix Cpsr size for WoA64 target

CPSR on Arm64 is 4 bytes in size but windows on Arm implementation is trying to read/write 8 bytes against a byte register causing LLDB unit tests failures.

Ref: https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-arm64_nt_context

Reviewed By: mstorsjo

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

Added: 
    

Modified: 
    lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
    lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
index 1294928e09a5d..fc65945723218 100644
--- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
@@ -220,7 +220,7 @@ Status NativeRegisterContextWindows_arm64::GPRRead(const uint32_t reg,
     reg_value.SetUInt64(tls_context.Pc);
     break;
   case gpr_cpsr_arm64:
-    reg_value.SetUInt64(tls_context.Cpsr);
+    reg_value.SetUInt32(tls_context.Cpsr);
     break;
 
   case gpr_w0_arm64:
@@ -317,7 +317,7 @@ NativeRegisterContextWindows_arm64::GPRWrite(const uint32_t reg,
     tls_context.Pc = reg_value.GetAsUInt64();
     break;
   case gpr_cpsr_arm64:
-    tls_context.Cpsr = reg_value.GetAsUInt64();
+    tls_context.Cpsr = reg_value.GetAsUInt32();
     break;
 
   case gpr_w0_arm64:

diff  --git a/lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp b/lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
index 10bab7d37561d..3ce288597c86a 100644
--- a/lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
@@ -171,7 +171,7 @@ bool RegisterContextWindows_arm64::ReadRegister(const RegisterInfo *reg_info,
     reg_value.SetUInt64(m_context.Pc);
     break;
   case gpr_cpsr:
-    reg_value.SetUInt64(m_context.Cpsr);
+    reg_value.SetUInt32(m_context.Cpsr);
     break;
 
   case gpr_w0:
@@ -385,7 +385,7 @@ bool RegisterContextWindows_arm64::WriteRegister(
     m_context.Pc = reg_value.GetAsUInt64();
     break;
   case gpr_cpsr:
-    m_context.Cpsr = reg_value.GetAsUInt64();
+    m_context.Cpsr = reg_value.GetAsUInt32();
     break;
 
   case fpu_v0:


        


More information about the lldb-commits mailing list