aboutsummaryrefslogtreecommitdiff
path: root/src/processor/stackwalker_arm64.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/processor/stackwalker_arm64.cc')
-rw-r--r--src/processor/stackwalker_arm64.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/processor/stackwalker_arm64.cc b/src/processor/stackwalker_arm64.cc
index 5bfd2636..ae3a0595 100644
--- a/src/processor/stackwalker_arm64.cc
+++ b/src/processor/stackwalker_arm64.cc
@@ -1,5 +1,4 @@
-// Copyright (c) 2013 Google Inc.
-// All rights reserved.
+// Copyright 2013 Google LLC
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -11,7 +10,7 @@
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
-// * Neither the name of Google Inc. nor the names of its
+// * Neither the name of Google LLC nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
@@ -99,7 +98,7 @@ StackFrame* StackwalkerARM64::GetContextFrame() {
}
StackFrameARM64* StackwalkerARM64::GetCallerByCFIFrameInfo(
- const vector<StackFrame*> &frames,
+ const vector<StackFrame*>& frames,
CFIFrameInfo* cfi_frame_info) {
StackFrameARM64* last_frame = static_cast<StackFrameARM64*>(frames.back());
@@ -170,18 +169,21 @@ StackFrameARM64* StackwalkerARM64::GetCallerByCFIFrameInfo(
if ((frame->context_validity & essentials) != essentials)
return NULL;
+ frame->context.iregs[MD_CONTEXT_ARM64_REG_PC] =
+ PtrauthStrip(frame->context.iregs[MD_CONTEXT_ARM64_REG_PC]);
frame->trust = StackFrame::FRAME_TRUST_CFI;
return frame.release();
}
StackFrameARM64* StackwalkerARM64::GetCallerByStackScan(
- const vector<StackFrame*> &frames) {
+ const vector<StackFrame*>& frames) {
StackFrameARM64* last_frame = static_cast<StackFrameARM64*>(frames.back());
uint64_t last_sp = last_frame->context.iregs[MD_CONTEXT_ARM64_REG_SP];
uint64_t caller_sp, caller_pc;
if (!ScanForReturnAddress(last_sp, &caller_sp, &caller_pc,
- frames.size() == 1 /* is_context_frame */)) {
+ /*is_context_frame=*/last_frame->trust ==
+ StackFrame::FRAME_TRUST_CONTEXT)) {
// No plausible return address was found.
return NULL;
}
@@ -206,7 +208,7 @@ StackFrameARM64* StackwalkerARM64::GetCallerByStackScan(
}
StackFrameARM64* StackwalkerARM64::GetCallerByFramePointer(
- const vector<StackFrame*> &frames) {
+ const vector<StackFrame*>& frames) {
StackFrameARM64* last_frame = static_cast<StackFrameARM64*>(frames.back());
if (!(last_frame->context_validity & StackFrameARM64::CONTEXT_VALID_LR)) {
CorrectRegLRByFramePointer(frames, last_frame);
@@ -294,7 +296,7 @@ StackFrame* StackwalkerARM64::GetCallerFrame(const CallStack* stack,
return NULL;
}
- const vector<StackFrame*> &frames = *stack->frames();
+ const vector<StackFrame*>& frames = *stack->frames();
StackFrameARM64* last_frame = static_cast<StackFrameARM64*>(frames.back());
scoped_ptr<StackFrameARM64> frame;
@@ -320,7 +322,8 @@ StackFrame* StackwalkerARM64::GetCallerFrame(const CallStack* stack,
if (TerminateWalk(frame->context.iregs[MD_CONTEXT_ARM64_REG_PC],
frame->context.iregs[MD_CONTEXT_ARM64_REG_SP],
last_frame->context.iregs[MD_CONTEXT_ARM64_REG_SP],
- frames.size() == 1)) {
+ /*first_unwind=*/last_frame->trust ==
+ StackFrame::FRAME_TRUST_CONTEXT)) {
return NULL;
}