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