[libcxx-commits] [compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

Anatoly Trosinenko via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 6 12:51:03 PDT 2025


================
@@ -680,11 +682,19 @@ int CompactUnwinder_arm64<A>::stepWithCompactEncodingFrame(
     savedRegisterLoc -= 8;
   }
 
-  uint64_t fp = registers.getFP();
+  Registers_arm64::reg_t fp = registers.getFP();
   // fp points to old fp
   registers.setFP(addressSpace.get64(fp));
-  // old sp is fp less saved fp and lr
+
+  // old sp is fp less saved fp and lr. Set this before FP & LR because in
+  // arm64e it's the discriminator used for those registers.
   registers.setSP(fp + 16);
+
+  Registers_arm64::reg_t oldfp = addressSpace.get64(fp);
+
+  // fp points to old fp
+  registers.setFP(oldfp);
----------------
atrosinenko wrote:

This is probably redundant, as `setFP(oldfp)` simply assigns its argument to `_registers.__fp`.

https://github.com/llvm/llvm-project/pull/143230


More information about the libcxx-commits mailing list