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