1*b725ae77Skettenis /* Definitions for a frame base, for GDB, the GNU debugger. 2*b725ae77Skettenis 3*b725ae77Skettenis Copyright 2003 Free Software Foundation, Inc. 4*b725ae77Skettenis 5*b725ae77Skettenis This file is part of GDB. 6*b725ae77Skettenis 7*b725ae77Skettenis This program is free software; you can redistribute it and/or modify 8*b725ae77Skettenis it under the terms of the GNU General Public License as published by 9*b725ae77Skettenis the Free Software Foundation; either version 2 of the License, or 10*b725ae77Skettenis (at your option) any later version. 11*b725ae77Skettenis 12*b725ae77Skettenis This program is distributed in the hope that it will be useful, 13*b725ae77Skettenis but WITHOUT ANY WARRANTY; without even the implied warranty of 14*b725ae77Skettenis MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*b725ae77Skettenis GNU General Public License for more details. 16*b725ae77Skettenis 17*b725ae77Skettenis You should have received a copy of the GNU General Public License 18*b725ae77Skettenis along with this program; if not, write to the Free Software 19*b725ae77Skettenis Foundation, Inc., 59 Temple Place - Suite 330, 20*b725ae77Skettenis Boston, MA 02111-1307, USA. */ 21*b725ae77Skettenis 22*b725ae77Skettenis #if !defined (FRAME_BASE_H) 23*b725ae77Skettenis #define FRAME_BASE_H 1 24*b725ae77Skettenis 25*b725ae77Skettenis struct frame_info; 26*b725ae77Skettenis struct frame_id; 27*b725ae77Skettenis struct frame_unwind; 28*b725ae77Skettenis struct frame_base; 29*b725ae77Skettenis struct gdbarch; 30*b725ae77Skettenis struct regcache; 31*b725ae77Skettenis 32*b725ae77Skettenis /* Assuming the frame chain: (outer) prev <-> this <-> next (inner); 33*b725ae77Skettenis and that this is a `normal frame'; use the NEXT frame, and its 34*b725ae77Skettenis register unwind method, to determine the address of THIS frame's 35*b725ae77Skettenis `base'. 36*b725ae77Skettenis 37*b725ae77Skettenis The exact meaning of `base' is highly dependant on the type of the 38*b725ae77Skettenis debug info. It is assumed that dwarf2, stabs, ... will each 39*b725ae77Skettenis provide their own methods. 40*b725ae77Skettenis 41*b725ae77Skettenis A typical implmentation will return the same value for base, 42*b725ae77Skettenis locals-base and args-base. That value, however, will likely be 43*b725ae77Skettenis different to the frame ID's stack address. */ 44*b725ae77Skettenis 45*b725ae77Skettenis /* A generic base address. */ 46*b725ae77Skettenis 47*b725ae77Skettenis typedef CORE_ADDR (frame_this_base_ftype) (struct frame_info *next_frame, 48*b725ae77Skettenis void **this_base_cache); 49*b725ae77Skettenis 50*b725ae77Skettenis /* The base address of the frame's local variables. */ 51*b725ae77Skettenis 52*b725ae77Skettenis typedef CORE_ADDR (frame_this_locals_ftype) (struct frame_info *next_frame, 53*b725ae77Skettenis void **this_base_cache); 54*b725ae77Skettenis 55*b725ae77Skettenis /* The base address of the frame's arguments / parameters. */ 56*b725ae77Skettenis 57*b725ae77Skettenis typedef CORE_ADDR (frame_this_args_ftype) (struct frame_info *next_frame, 58*b725ae77Skettenis void **this_base_cache); 59*b725ae77Skettenis 60*b725ae77Skettenis struct frame_base 61*b725ae77Skettenis { 62*b725ae77Skettenis /* If non-NULL, a low-level unwinder that shares its implementation 63*b725ae77Skettenis with this high-level frame-base method. */ 64*b725ae77Skettenis const struct frame_unwind *unwind; 65*b725ae77Skettenis frame_this_base_ftype *this_base; 66*b725ae77Skettenis frame_this_locals_ftype *this_locals; 67*b725ae77Skettenis frame_this_args_ftype *this_args; 68*b725ae77Skettenis }; 69*b725ae77Skettenis 70*b725ae77Skettenis /* Given the NEXT frame, return the frame base methods for THIS frame, 71*b725ae77Skettenis or NULL if it can't handle THIS frame. */ 72*b725ae77Skettenis 73*b725ae77Skettenis typedef const struct frame_base *(frame_base_sniffer_ftype) (struct frame_info *next_frame); 74*b725ae77Skettenis 75*b725ae77Skettenis /* Append a frame base sniffer to the list. The sniffers are polled 76*b725ae77Skettenis in the order that they are appended. */ 77*b725ae77Skettenis 78*b725ae77Skettenis extern void frame_base_append_sniffer (struct gdbarch *gdbarch, 79*b725ae77Skettenis frame_base_sniffer_ftype *sniffer); 80*b725ae77Skettenis 81*b725ae77Skettenis /* Set the default frame base. If all else fails, this one is 82*b725ae77Skettenis returned. If this isn't set, the default is to use legacy code 83*b725ae77Skettenis that uses things like the frame ID's base (ulgh!). */ 84*b725ae77Skettenis 85*b725ae77Skettenis extern void frame_base_set_default (struct gdbarch *gdbarch, 86*b725ae77Skettenis const struct frame_base *def); 87*b725ae77Skettenis 88*b725ae77Skettenis /* Iterate through the list of frame base handlers until one returns 89*b725ae77Skettenis an implementation. */ 90*b725ae77Skettenis 91*b725ae77Skettenis extern const struct frame_base *frame_base_find_by_frame (struct frame_info *next_frame); 92*b725ae77Skettenis 93*b725ae77Skettenis #endif 94