Commit | Line | Data |
---|---|---|
da62e633 AC |
1 | /* Definitions for a frame base, for GDB, the GNU debugger. |
2 | ||
b811d2c2 | 3 | Copyright (C) 2003-2020 Free Software Foundation, Inc. |
da62e633 AC |
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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
da62e633 AC |
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 | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
da62e633 AC |
19 | |
20 | #if !defined (FRAME_BASE_H) | |
21 | #define FRAME_BASE_H 1 | |
22 | ||
23 | struct frame_info; | |
24 | struct frame_id; | |
25 | struct frame_unwind; | |
26 | struct frame_base; | |
27 | struct gdbarch; | |
28 | struct regcache; | |
29 | ||
da62e633 | 30 | /* Assuming the frame chain: (outer) prev <-> this <-> next (inner); |
669fac23 DJ |
31 | and that this is a `normal frame'; use THIS frame, and implicitly |
32 | the NEXT frame's register unwind method, to determine the address | |
33 | of THIS frame's `base'. | |
da62e633 AC |
34 | |
35 | The exact meaning of `base' is highly dependant on the type of the | |
36 | debug info. It is assumed that dwarf2, stabs, ... will each | |
37 | provide their own methods. | |
38 | ||
30baf67b | 39 | A typical implementation will return the same value for base, |
da62e633 AC |
40 | locals-base and args-base. That value, however, will likely be |
41 | different to the frame ID's stack address. */ | |
42 | ||
43 | /* A generic base address. */ | |
44 | ||
669fac23 | 45 | typedef CORE_ADDR (frame_this_base_ftype) (struct frame_info *this_frame, |
da62e633 AC |
46 | void **this_base_cache); |
47 | ||
48 | /* The base address of the frame's local variables. */ | |
49 | ||
669fac23 | 50 | typedef CORE_ADDR (frame_this_locals_ftype) (struct frame_info *this_frame, |
da62e633 AC |
51 | void **this_base_cache); |
52 | ||
53 | /* The base address of the frame's arguments / parameters. */ | |
54 | ||
669fac23 | 55 | typedef CORE_ADDR (frame_this_args_ftype) (struct frame_info *this_frame, |
da62e633 AC |
56 | void **this_base_cache); |
57 | ||
58 | struct frame_base | |
59 | { | |
60 | /* If non-NULL, a low-level unwinder that shares its implementation | |
61 | with this high-level frame-base method. */ | |
62 | const struct frame_unwind *unwind; | |
63 | frame_this_base_ftype *this_base; | |
64 | frame_this_locals_ftype *this_locals; | |
65 | frame_this_args_ftype *this_args; | |
66 | }; | |
67 | ||
669fac23 | 68 | /* Given THIS frame, return the frame base methods for THIS frame, |
e8a89fe2 AC |
69 | or NULL if it can't handle THIS frame. */ |
70 | ||
669fac23 | 71 | typedef const struct frame_base *(frame_base_sniffer_ftype) (struct frame_info *this_frame); |
e8a89fe2 AC |
72 | |
73 | /* Append a frame base sniffer to the list. The sniffers are polled | |
74 | in the order that they are appended. */ | |
75 | ||
76 | extern void frame_base_append_sniffer (struct gdbarch *gdbarch, | |
77 | frame_base_sniffer_ftype *sniffer); | |
78 | ||
79 | /* Set the default frame base. If all else fails, this one is | |
80 | returned. If this isn't set, the default is to use legacy code | |
81 | that uses things like the frame ID's base (ulgh!). */ | |
82 | ||
83 | extern void frame_base_set_default (struct gdbarch *gdbarch, | |
84 | const struct frame_base *def); | |
85 | ||
86 | /* Iterate through the list of frame base handlers until one returns | |
87 | an implementation. */ | |
88 | ||
669fac23 | 89 | extern const struct frame_base *frame_base_find_by_frame (struct frame_info *this_frame); |
e8a89fe2 | 90 | |
da62e633 | 91 | #endif |