15796c8dcSSimon Schubert /* Definitions for a frame base, for GDB, the GNU debugger. 25796c8dcSSimon Schubert 3*ef5ccd6cSJohn Marino Copyright (C) 2003-2013 Free Software Foundation, Inc. 45796c8dcSSimon Schubert 55796c8dcSSimon Schubert This file is part of GDB. 65796c8dcSSimon Schubert 75796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 85796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 95796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 105796c8dcSSimon Schubert (at your option) any later version. 115796c8dcSSimon Schubert 125796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 135796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 145796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 155796c8dcSSimon Schubert GNU General Public License for more details. 165796c8dcSSimon Schubert 175796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 185796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */ 195796c8dcSSimon Schubert 205796c8dcSSimon Schubert #if !defined (FRAME_BASE_H) 215796c8dcSSimon Schubert #define FRAME_BASE_H 1 225796c8dcSSimon Schubert 235796c8dcSSimon Schubert struct frame_info; 245796c8dcSSimon Schubert struct frame_id; 255796c8dcSSimon Schubert struct frame_unwind; 265796c8dcSSimon Schubert struct frame_base; 275796c8dcSSimon Schubert struct gdbarch; 285796c8dcSSimon Schubert struct regcache; 295796c8dcSSimon Schubert 305796c8dcSSimon Schubert /* Assuming the frame chain: (outer) prev <-> this <-> next (inner); 315796c8dcSSimon Schubert and that this is a `normal frame'; use THIS frame, and implicitly 325796c8dcSSimon Schubert the NEXT frame's register unwind method, to determine the address 335796c8dcSSimon Schubert of THIS frame's `base'. 345796c8dcSSimon Schubert 355796c8dcSSimon Schubert The exact meaning of `base' is highly dependant on the type of the 365796c8dcSSimon Schubert debug info. It is assumed that dwarf2, stabs, ... will each 375796c8dcSSimon Schubert provide their own methods. 385796c8dcSSimon Schubert 395796c8dcSSimon Schubert A typical implmentation will return the same value for base, 405796c8dcSSimon Schubert locals-base and args-base. That value, however, will likely be 415796c8dcSSimon Schubert different to the frame ID's stack address. */ 425796c8dcSSimon Schubert 435796c8dcSSimon Schubert /* A generic base address. */ 445796c8dcSSimon Schubert 455796c8dcSSimon Schubert typedef CORE_ADDR (frame_this_base_ftype) (struct frame_info *this_frame, 465796c8dcSSimon Schubert void **this_base_cache); 475796c8dcSSimon Schubert 485796c8dcSSimon Schubert /* The base address of the frame's local variables. */ 495796c8dcSSimon Schubert 505796c8dcSSimon Schubert typedef CORE_ADDR (frame_this_locals_ftype) (struct frame_info *this_frame, 515796c8dcSSimon Schubert void **this_base_cache); 525796c8dcSSimon Schubert 535796c8dcSSimon Schubert /* The base address of the frame's arguments / parameters. */ 545796c8dcSSimon Schubert 555796c8dcSSimon Schubert typedef CORE_ADDR (frame_this_args_ftype) (struct frame_info *this_frame, 565796c8dcSSimon Schubert void **this_base_cache); 575796c8dcSSimon Schubert 585796c8dcSSimon Schubert struct frame_base 595796c8dcSSimon Schubert { 605796c8dcSSimon Schubert /* If non-NULL, a low-level unwinder that shares its implementation 615796c8dcSSimon Schubert with this high-level frame-base method. */ 625796c8dcSSimon Schubert const struct frame_unwind *unwind; 635796c8dcSSimon Schubert frame_this_base_ftype *this_base; 645796c8dcSSimon Schubert frame_this_locals_ftype *this_locals; 655796c8dcSSimon Schubert frame_this_args_ftype *this_args; 665796c8dcSSimon Schubert }; 675796c8dcSSimon Schubert 685796c8dcSSimon Schubert /* Given THIS frame, return the frame base methods for THIS frame, 695796c8dcSSimon Schubert or NULL if it can't handle THIS frame. */ 705796c8dcSSimon Schubert 715796c8dcSSimon Schubert typedef const struct frame_base *(frame_base_sniffer_ftype) (struct frame_info *this_frame); 725796c8dcSSimon Schubert 735796c8dcSSimon Schubert /* Append a frame base sniffer to the list. The sniffers are polled 745796c8dcSSimon Schubert in the order that they are appended. */ 755796c8dcSSimon Schubert 765796c8dcSSimon Schubert extern void frame_base_append_sniffer (struct gdbarch *gdbarch, 775796c8dcSSimon Schubert frame_base_sniffer_ftype *sniffer); 785796c8dcSSimon Schubert 795796c8dcSSimon Schubert /* Set the default frame base. If all else fails, this one is 805796c8dcSSimon Schubert returned. If this isn't set, the default is to use legacy code 815796c8dcSSimon Schubert that uses things like the frame ID's base (ulgh!). */ 825796c8dcSSimon Schubert 835796c8dcSSimon Schubert extern void frame_base_set_default (struct gdbarch *gdbarch, 845796c8dcSSimon Schubert const struct frame_base *def); 855796c8dcSSimon Schubert 865796c8dcSSimon Schubert /* Iterate through the list of frame base handlers until one returns 875796c8dcSSimon Schubert an implementation. */ 885796c8dcSSimon Schubert 895796c8dcSSimon Schubert extern const struct frame_base *frame_base_find_by_frame (struct frame_info *this_frame); 905796c8dcSSimon Schubert 915796c8dcSSimon Schubert #endif 92