diff options
author | Jason Molenda <jmolenda@apple.com> | 2025-05-09 20:07:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-09 20:07:12 -0700 |
commit | e897cb139ee6ef5c145fed5394c4d96baa658e6b (patch) | |
tree | cd2ec2beb002744ebbe2d62aac79908b6e96bf0a /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 2d2d753e01b8fae0ff35b5018d1f47499eee3a81 (diff) | |
download | llvm-e897cb139ee6ef5c145fed5394c4d96baa658e6b.zip llvm-e897cb139ee6ef5c145fed5394c4d96baa658e6b.tar.gz llvm-e897cb139ee6ef5c145fed5394c4d96baa658e6b.tar.bz2 |
[lldb] Provide lr value in faulting frame on arm64 (#138805)
When a frameless function faults or is interrupted asynchronously, the
UnwindPlan MAY have no register location rule for the return address
register (lr on arm64); the value is simply live in the lr register when
it was interrupted, and the frame below this on the stack -- e.g.
sigtramp on a Unix system -- has the full register context, including
that register.
RegisterContextUnwind::SavedLocationForRegister, when asked to find the
caller's pc value, will first see if there is a pc register location. If
there isn't, on a Return Address Register architecture like
arm/mips/riscv, we rewrite the register request from "pc" to "RA
register", and search for a location.
On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may
have no register location rule for the RA Reg, that is valid. A
frameless function that never calls another may simply keep the return
address in the live register the whole way. Our instruction emulation
unwind plans explicitly add a rule (see Pavel's May 2024 change
https://github.com/llvm/llvm-project/pull/91321 ), but an UnwindPlan
sourced from debug_frame may not.
I've got a case where this exactly happens - clang debug_frame for arm64
where there is no register location for the lr in a frameless function.
There is a fault in the middle of this frameless function and we only
get the lr value from the fault handler below this frame if lr has a
register location of `IsSame`, in line with Pavel's 2024 change.
Similar to how we see a request of the RA Reg from frame 0 after failing
to find an unwind location for the pc register, the same style of
special casing is needed when this is a function that was interrupted.
Without this change, we can find the pc of the frame that was executing
when it was interrupted, but we need $lr to find its caller, and we
don't descend down to the trap handler to get that value, truncating the
stack.
rdar://145614545
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions