Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1125)

Unified Diff: src/processor/stackwalker_arm64.cc

Issue 1884503002: Fix arm64 frame-pointer stackwalker Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 |
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698