struct CallFrame

Defined at line 75 of file ../../zircon/kernel/lib/arch/include/lib/arch/backtrace.h

Each frame records its caller's FP and PC (return address). A call pushes

the PC and the prologue then pushes the caller's FP (x86), or the prologue

pushes the return-address register and PC together (other CPUs). Since the

stack grows down, the PC is always just after the FP in memory. It then

sets the FP to point at (or above) the FP, PC pair just pushed. On x86 it's

unavoidable that the FP is two words below the CFA (SP at call site), since

the call itself puts the PC there; the FP points directly to the FP, PC pair

describing the caller. On ARM, the compiler will often place the FP, PC

pair at the bottom of the new frame instead of the top; the FP points

directly to the FP, PC pair describing the caller, but there's no guarantee

where the FP is in relation to the CFA. On RISC-V, the FP is set to the CFA

(SP at call site / entry); so it points *just past* the FP, PC pair

describing the caller, but it's also guaranteed to be the CFA.

Public Members

const CallFrame * fp
uintptr_t pc

Public Methods

std::strong_ordering operator<=> (const CallFrame & )

Frames are ordered by FP address. Since stacks grow down, the least

address means the innermost callee.

Defined at line 78 of file ../../zircon/kernel/lib/arch/include/lib/arch/backtrace.h

uintptr_t frame_address ()

On most machines, this is the CFA, which is the SP at the call site and

thus the address that's the upper bound on this call frame. On ARM it's

more likely to be near the bottom of the frame, but will still at least be

an upper bound on the address range of the next frame in.

Defined at line 84 of file ../../zircon/kernel/lib/arch/include/lib/arch/backtrace.h