================
@@ -42,64 +44,111 @@ bool RegisterContextFreeBSDKernel_arm64::ReadRegister(
   if (m_pcb_addr == LLDB_INVALID_ADDRESS)
     return false;
 
+  struct {
+#define PCB_FP 10
+#define PCB_LR 11
+    llvm::support::ulittle64_t x[12];
+    llvm::support::ulittle64_t sp;
+  } pcb;
+
   struct {
     llvm::support::ulittle64_t x[30];
     llvm::support::ulittle64_t lr;
     llvm::support::ulittle64_t _reserved;
     llvm::support::ulittle64_t sp;
-  } pcb;
+  } pcb13;
 
   Status error;
-  size_t rd =
-      m_thread.GetProcess()->ReadMemory(m_pcb_addr, &pcb, sizeof(pcb), error);
-  if (rd != sizeof(pcb))
-    return false;
 
-  uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
-  switch (reg) {
-  case gpr_x0_arm64:
-  case gpr_x1_arm64:
-  case gpr_x2_arm64:
-  case gpr_x3_arm64:
-  case gpr_x4_arm64:
-  case gpr_x5_arm64:
-  case gpr_x6_arm64:
-  case gpr_x7_arm64:
-  case gpr_x8_arm64:
-  case gpr_x9_arm64:
-  case gpr_x10_arm64:
-  case gpr_x11_arm64:
-  case gpr_x12_arm64:
-  case gpr_x13_arm64:
-  case gpr_x14_arm64:
-  case gpr_x15_arm64:
-  case gpr_x16_arm64:
-  case gpr_x17_arm64:
-  case gpr_x18_arm64:
-  case gpr_x19_arm64:
-  case gpr_x20_arm64:
-  case gpr_x21_arm64:
-  case gpr_x22_arm64:
-  case gpr_x23_arm64:
-  case gpr_x24_arm64:
-  case gpr_x25_arm64:
-  case gpr_x26_arm64:
-  case gpr_x27_arm64:
-  case gpr_x28_arm64:
-  case gpr_fp_arm64:
-    static_assert(gpr_fp_arm64 - gpr_x0_arm64 == 29,
-                  "nonconsecutive arm64 register numbers");
-    value = pcb.x[reg - gpr_x0_arm64];
-    break;
-  case gpr_sp_arm64:
-    value = pcb.sp;
-    break;
-  case gpr_pc_arm64:
-    // The pc of crashing thread is stored in lr.
-    value = pcb.lr;
-    break;
-  default:
-    return false;
+  // TODO: LLVM 24: Remove FreeBSD 13 support
+  if (GetOsreldate() > 1400084) {
----------------
DavidSpickett wrote:

I don't actually see the change of __FreeBSD_version in 
https://github.com/freebsd/freebsd-src/commit/1c1f31a5e517ebb940c752c3468b03cdc687c5c7#diff-d07b4e228ca340857a90658e328d65f8dea9c5063e99197fbaaa046d97ae927c.

I wanted to check the right number was being checked here. Please find when it 
was bumped and link that commit in the PR description too. (even if it is the 
case that it was forgotten, and you're using the next time it was bumped for 
some other reason)

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

Reply via email to