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