[Lldb-commits] [PATCH] D112471: [LLDB] Fix Cpsr size for WoA64 target

Muhammad Omair Javaid via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 25 10:43:22 PDT 2021


omjavaid created this revision.
omjavaid added reviewers: mstorsjo, DavidSpickett.
Herald added a subscriber: kristof.beyls.
omjavaid requested review of this revision.

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


https://reviews.llvm.org/D112471

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


Index: lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
===================================================================
--- lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
+++ lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
@@ -171,7 +171,7 @@
     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 @@
     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:
Index: lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
===================================================================
--- lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
+++ lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
@@ -220,7 +220,7 @@
     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 @@
     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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112471.382045.patch
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211025/1b7146aa/attachment-0001.bin>


More information about the lldb-commits mailing list