#### 11.7.5 Functions to Access Frame Data

These functions provide access to key registers and arguments in the stack frame.

— Architecture Function: CORE_ADDR unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)

> This function is given a pointer to the NEXT stack frame (see All About Stack Frames, for how frames are represented) and returns the value of the program counter in the PREVIOUS frame (i.e. the frame of the function that called THIS one). This is commonly referred to as the return address.

> The implementation, which must be frame agnostic (work with any frame), is typically no more than:

>               ULONGEST pc;
>               pc = frame_unwind_register_unsigned (next_frame, ARCH_PC_REGNUM);
>               return gdbarch_addr_bits_remove (gdbarch, pc);

— Architecture Function: CORE_ADDR unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)

> This function is given a pointer to the NEXT stack frame (see All About Stack Frames for how frames are represented) and returns the value of the stack pointer in the PREVIOUS frame (i.e. the frame of the function that called THIS one).

> The implementation, which must be frame agnostic (work with any frame), is typically no more than:

>               ULONGEST sp;
>               sp = frame_unwind_register_unsigned (next_frame, ARCH_SP_REGNUM);
>               return gdbarch_addr_bits_remove (gdbarch, sp);

— Architecture Function: int frame_num_args (struct gdbarch *gdbarch, struct frame_info *this_frame)

> This function is given a pointer to THIS stack frame (see All About Stack Frames for how frames are represented), and returns the number of arguments that are being passed, or -1 if not known.

> The default value is `NULL` (undefined), in which case the number of arguments passed on any stack frame is always unknown. For many architectures this will be a suitable default.