| Index: src/processor/stackwalker_arm64.cc
|
| diff --git a/src/processor/stackwalker_arm64.cc b/src/processor/stackwalker_arm64.cc
|
| index 31119a97e1d087aa22453ab5aabfc4053d5f1fb4..e8587325c5f1e3286732525661eafa0cb8852c44 100644
|
| --- a/src/processor/stackwalker_arm64.cc
|
| +++ b/src/processor/stackwalker_arm64.cc
|
| @@ -195,13 +195,22 @@ StackFrameARM64* StackwalkerARM64::GetCallerByFramePointer(
|
| return NULL;
|
| }
|
|
|
| - uint64_t caller_lr = 0;
|
| - if (last_fp && !memory_->GetMemoryAtAddress(last_fp + 8, &caller_lr)) {
|
| - BPLOG(ERROR) << "Unable to read caller_lr from last_fp + 8: 0x"
|
| + // The memory at last_fp + 8 is the last frame's LR (callee's lr), which is
|
| + // the PC of the caller.
|
| + uint64_t caller_pc = 0;
|
| + if (last_fp && !memory_->GetMemoryAtAddress(last_fp + 8, &caller_pc)) {
|
| + BPLOG(ERROR) << "Unable to read caller_pc from last_fp + 8: 0x"
|
| << std::hex << (last_fp + 8);
|
| return NULL;
|
| }
|
|
|
| + uint64_t caller_lr = 0;
|
| + if (last_fp && !memory_->GetMemoryAtAddress(caller_fp + 8, &caller_lr)) {
|
| + BPLOG(ERROR) << "Unable to read caller_lr from caller_fp + 8: 0x"
|
| + << std::hex << (caller_fp + 8);
|
| + return NULL;
|
| + }
|
| +
|
| uint64_t caller_sp = last_fp ? last_fp + 16 :
|
| last_frame->context.iregs[MD_CONTEXT_ARM64_REG_SP];
|
|
|
| @@ -213,8 +222,7 @@ StackFrameARM64* StackwalkerARM64::GetCallerByFramePointer(
|
| frame->context = last_frame->context;
|
| frame->context.iregs[MD_CONTEXT_ARM64_REG_FP] = caller_fp;
|
| frame->context.iregs[MD_CONTEXT_ARM64_REG_SP] = caller_sp;
|
| - frame->context.iregs[MD_CONTEXT_ARM64_REG_PC] =
|
| - last_frame->context.iregs[MD_CONTEXT_ARM64_REG_LR];
|
| + frame->context.iregs[MD_CONTEXT_ARM64_REG_PC] = caller_pc;
|
| frame->context.iregs[MD_CONTEXT_ARM64_REG_LR] = caller_lr;
|
| frame->context_validity = StackFrameARM64::CONTEXT_VALID_PC |
|
| StackFrameARM64::CONTEXT_VALID_LR |
|
|
|