1130803Smarcel/* Definitions for a frame base, for GDB, the GNU debugger.
2130803Smarcel
3130803Smarcel   Copyright 2003 Free Software Foundation, Inc.
4130803Smarcel
5130803Smarcel   This file is part of GDB.
6130803Smarcel
7130803Smarcel   This program is free software; you can redistribute it and/or modify
8130803Smarcel   it under the terms of the GNU General Public License as published by
9130803Smarcel   the Free Software Foundation; either version 2 of the License, or
10130803Smarcel   (at your option) any later version.
11130803Smarcel
12130803Smarcel   This program is distributed in the hope that it will be useful,
13130803Smarcel   but WITHOUT ANY WARRANTY; without even the implied warranty of
14130803Smarcel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15130803Smarcel   GNU General Public License for more details.
16130803Smarcel
17130803Smarcel   You should have received a copy of the GNU General Public License
18130803Smarcel   along with this program; if not, write to the Free Software
19130803Smarcel   Foundation, Inc., 59 Temple Place - Suite 330,
20130803Smarcel   Boston, MA 02111-1307, USA.  */
21130803Smarcel
22130803Smarcel#if !defined (FRAME_BASE_H)
23130803Smarcel#define FRAME_BASE_H 1
24130803Smarcel
25130803Smarcelstruct frame_info;
26130803Smarcelstruct frame_id;
27130803Smarcelstruct frame_unwind;
28130803Smarcelstruct frame_base;
29130803Smarcelstruct gdbarch;
30130803Smarcelstruct regcache;
31130803Smarcel
32130803Smarcel/* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
33130803Smarcel   and that this is a `normal frame'; use the NEXT frame, and its
34130803Smarcel   register unwind method, to determine the address of THIS frame's
35130803Smarcel   `base'.
36130803Smarcel
37130803Smarcel   The exact meaning of `base' is highly dependant on the type of the
38130803Smarcel   debug info.  It is assumed that dwarf2, stabs, ... will each
39130803Smarcel   provide their own methods.
40130803Smarcel
41130803Smarcel   A typical implmentation will return the same value for base,
42130803Smarcel   locals-base and args-base.  That value, however, will likely be
43130803Smarcel   different to the frame ID's stack address.  */
44130803Smarcel
45130803Smarcel/* A generic base address.  */
46130803Smarcel
47130803Smarceltypedef CORE_ADDR (frame_this_base_ftype) (struct frame_info *next_frame,
48130803Smarcel					   void **this_base_cache);
49130803Smarcel
50130803Smarcel/* The base address of the frame's local variables.  */
51130803Smarcel
52130803Smarceltypedef CORE_ADDR (frame_this_locals_ftype) (struct frame_info *next_frame,
53130803Smarcel					     void **this_base_cache);
54130803Smarcel
55130803Smarcel/* The base address of the frame's arguments / parameters.  */
56130803Smarcel
57130803Smarceltypedef CORE_ADDR (frame_this_args_ftype) (struct frame_info *next_frame,
58130803Smarcel					   void **this_base_cache);
59130803Smarcel
60130803Smarcelstruct frame_base
61130803Smarcel{
62130803Smarcel  /* If non-NULL, a low-level unwinder that shares its implementation
63130803Smarcel     with this high-level frame-base method.  */
64130803Smarcel  const struct frame_unwind *unwind;
65130803Smarcel  frame_this_base_ftype *this_base;
66130803Smarcel  frame_this_locals_ftype *this_locals;
67130803Smarcel  frame_this_args_ftype *this_args;
68130803Smarcel};
69130803Smarcel
70130803Smarcel/* Given the NEXT frame, return the frame base methods for THIS frame,
71130803Smarcel   or NULL if it can't handle THIS frame.  */
72130803Smarcel
73130803Smarceltypedef const struct frame_base *(frame_base_sniffer_ftype) (struct frame_info *next_frame);
74130803Smarcel
75130803Smarcel/* Append a frame base sniffer to the list.  The sniffers are polled
76130803Smarcel   in the order that they are appended.  */
77130803Smarcel
78130803Smarcelextern void frame_base_append_sniffer (struct gdbarch *gdbarch,
79130803Smarcel				       frame_base_sniffer_ftype *sniffer);
80130803Smarcel
81130803Smarcel/* Set the default frame base.  If all else fails, this one is
82130803Smarcel   returned.  If this isn't set, the default is to use legacy code
83130803Smarcel   that uses things like the frame ID's base (ulgh!).  */
84130803Smarcel
85130803Smarcelextern void frame_base_set_default (struct gdbarch *gdbarch,
86130803Smarcel				    const struct frame_base *def);
87130803Smarcel
88130803Smarcel/* Iterate through the list of frame base handlers until one returns
89130803Smarcel   an implementation.  */
90130803Smarcel
91130803Smarcelextern const struct frame_base *frame_base_find_by_frame (struct frame_info *next_frame);
92130803Smarcel
93130803Smarcel#endif
94