This page was produced by an automated import process, and may have formatting errors; feel free to fix.

Functions and Variable to Analyze Frames

These struct gdbarch functions and variable should be defined to provide analysis of the stack frame and allow it to be adjusted as required.

Architecture Function: ''CORE_ADDR'' skip_prologue ''(struct gdbarch *''gdbarch'', CORE_ADDR ''pc'')''

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.

Architecture Function: ''int'' inner_than ''(CORE_ADDR ''lhs'', CORE_ADDR ''rhs'')''

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) or core_addr_greaterthan (for stacks growing up in memory). [frame_005falign ]

Architecture Function: ''CORE_ADDR'' frame_align ''(struct gdbarch *''gdbarch'', CORE_ADDR ''address'')''

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 functions align_down (for falling stacks) and align_up (for rising stacks) will facilitate the implementation of this function.

Architecture Variable: ''int'' frame_red_zone_size

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).

None: Internals Functions-and-Variable-to-Analyze-Frames (last edited 2013-08-20 23:40:46 by StanShebs)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.