Next: Functions to Access Frame Data, Previous: Prologue Caches, Up: Frame Interpretation
These struct gdbarch
functions and variable should be defined
to provide analysis of the stack frame and allow it to be adjusted as
required.
The prologue of a function is the code at the beginning of the function which sets up the stack frame, saves the return address etc. The code representing the behavior of the function starts after the prologue.
This function skips past the prologue of a function if the program counter, pc, is within the prologue of a function. The result is the program counter immediately after the prologue. With modern optimizing compilers, this may be a far from trivial exercise. However the required information may be within the binary as DWARF2 debugging information, making the job much easier.
The default value is
NULL
(not defined). This function should always be provided, but can take advantage of DWARF2 debugging information, if that is available.
Given two frame or stack pointers, return non-zero (true) if the first represents the inner stack frame and 0 (false) otherwise. This is used to determine whether the target has a stack which grows up in memory (rising stack) or grows down in memory (falling stack). See All About Stack Frames, for an explanation of inner frames.
The default value of this function is
NULL
and it should always be defined. However for almost all architectures one of the built-in functions can be used:core_addr_lessthan
(for stacks growing down in memory) orcore_addr_greaterthan
(for stacks growing up in memory).
The architecture may have constraints on how its frames are aligned. For example the OpenRISC 1000 ABI requires stack frames to be double-word aligned, but 32-bit versions of the architecture allocate single-word values to the stack. Thus extra padding may be needed at the end of a stack frame.
Given a proposed address for the stack pointer, this function returns a suitably aligned address (by expanding the stack frame).
The default value is
NULL
(undefined). This function should be defined for any architecture where it is possible the stack could become misaligned. The utility functionsalign_down
(for falling stacks) andalign_up
(for rising stacks) will facilitate the implementation of this function.
Some ABIs reserve space beyond the end of the stack for use by leaf functions without prologue or epilogue or by exception handlers (for example the OpenRISC 1000).
This is known as a red zone (AMD terminology). The amd64 (nee x86-64) ABI documentation refers to the red zone when describing this scratch area.
The default value is 0. Set this field if the architecture has such a red zone. The value must be aligned as required by the ABI (see
frame_align
above for an explanation of stack frame alignment).