llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Minsoo Choo (mchoo7)

<details>
<summary>Changes</summary>

This commit address two issues with arm64 RegisterContext on FreeBSDKernelCore. 
Since LR in pcb structure stores LR for normal threads and PC for crashed 
thread, both `gpr_lr_arm64` and `gpr_pc_arm64` should point to the same field 
(the LR field in pcb). Also pcb's LR fields stores LR not PC for normal threads 
(i.e non-crashed threads) but `gpr_lr_arm64` was not exposed for FreeBSD 13.

---
Full diff: https://github.com/llvm/llvm-project/pull/183947.diff


1 Files Affected:

- (modified) 
lldb/source/Plugins/Process/FreeBSD-Kernel-Core/RegisterContextFreeBSDKernelCore_arm64.cpp
 (+5-4) 


``````````diff
diff --git 
a/lldb/source/Plugins/Process/FreeBSD-Kernel-Core/RegisterContextFreeBSDKernelCore_arm64.cpp
 
b/lldb/source/Plugins/Process/FreeBSD-Kernel-Core/RegisterContextFreeBSDKernelCore_arm64.cpp
index afd60a64a6365..442fa9b12460f 100644
--- 
a/lldb/source/Plugins/Process/FreeBSD-Kernel-Core/RegisterContextFreeBSDKernelCore_arm64.cpp
+++ 
b/lldb/source/Plugins/Process/FreeBSD-Kernel-Core/RegisterContextFreeBSDKernelCore_arm64.cpp
@@ -101,7 +101,7 @@ bool RegisterContextFreeBSDKernelCore_arm64::ReadRegister(
       // The pc of crashing thread is stored in lr.
       static_assert(gpr_lr_arm64 - gpr_x19_arm64 == PCB_LR,
                     "nonconsecutive arm64 register numbers");
-      value = pcb.x[reg - gpr_x19_arm64];
+      value = pcb.x[gpr_lr_arm64 - gpr_x19_arm64];
       break;
     case gpr_sp_arm64:
       value = pcb.sp;
@@ -151,13 +151,14 @@ bool RegisterContextFreeBSDKernelCore_arm64::ReadRegister(
                     "nonconsecutive arm64 register numbers");
       value = pcb13.x[reg - gpr_x0_arm64];
       break;
-    case gpr_sp_arm64:
-      value = pcb13.sp;
-      break;
+    case gpr_lr_arm64:
     case gpr_pc_arm64:
       // The pc of crashing thread is stored in lr.
       value = pcb13.lr;
       break;
+    case gpr_sp_arm64:
+      value = pcb13.sp;
+      break;
     default:
       return false;
     }

``````````

</details>


https://github.com/llvm/llvm-project/pull/183947
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to