arm64: recover register X30(LR) when fallback to frame pointer unwinder

Stackwalk can't recover caller's register X30($LR) value by STACK CFI info.
This will lead unwinding stop immediately when fallback to frame pointer unwinder.

This PR will use try to use second last frame to recover register X30($LR) by frame pointer.
And we will give up correction if STACK CFI info doesn't agree with frame pointer info.

Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=808
Change-Id: I50649e3398e268b02ff297e83db21d05705c2a2d
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1992641
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Sim Sun 2020-01-14 21:48:37 -08:00 committed by Joshua Peraza
parent 4e15f7d230
commit 13c1568702
2 changed files with 46 additions and 0 deletions

View file

@ -90,6 +90,13 @@ class StackwalkerARM64 : public Stackwalker {
// of the returned frame. Return NULL on failure.
StackFrameARM64* GetCallerByStackScan(const vector<StackFrame*> &frames);
// GetCallerByFramePointer() depends on the previous frame having recovered
// x30($LR) which may not have been done when using CFI.
// This function recovers $LR in the previous frame by using the frame-pointer
// two frames back to read it from the stack.
void CorrectRegLRByFramePointer(const vector<StackFrame*>& frames,
StackFrameARM64* last_frame);
// Stores the CPU context corresponding to the youngest stack frame, to
// be returned by GetContextFrame.
const MDRawContextARM64* context_;