Commit | Line | Data |
---|---|---|
cfc14b3a MK |
1 | /* Frame unwinder for frames with DWARF Call Frame Information. |
2 | ||
4c38e0a4 | 3 | Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 |
0fb0cc75 | 4 | Free Software Foundation, Inc. |
cfc14b3a MK |
5 | |
6 | Contributed by Mark Kettenis. | |
7 | ||
8 | This file is part of GDB. | |
9 | ||
10 | This program is free software; you can redistribute it and/or modify | |
11 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 12 | the Free Software Foundation; either version 3 of the License, or |
cfc14b3a MK |
13 | (at your option) any later version. |
14 | ||
15 | This program is distributed in the hope that it will be useful, | |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 21 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
cfc14b3a MK |
22 | |
23 | #ifndef DWARF2_FRAME_H | |
24 | #define DWARF2_FRAME_H 1 | |
25 | ||
ecc9ac84 | 26 | struct gdbarch; |
cfc14b3a | 27 | struct objfile; |
e6e5e94c | 28 | struct frame_info; |
cfc14b3a | 29 | |
05cbe71a MK |
30 | /* Register rule. */ |
31 | ||
32 | enum dwarf2_frame_reg_rule | |
33 | { | |
34 | /* Make certain that 0 maps onto the correct enum value; the | |
35 | corresponding structure is being initialized using memset zero. | |
36 | This indicates that CFI didn't provide any information at all | |
37 | about a register, leaving how to obtain its value totally | |
38 | unspecified. */ | |
39 | DWARF2_FRAME_REG_UNSPECIFIED = 0, | |
40 | ||
41 | /* The term "undefined" comes from the DWARF2 CFI spec which this | |
42 | code is moddeling; it indicates that the register's value is | |
43 | "undefined". GCC uses the less formal term "unsaved". Its | |
44 | definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED. | |
45 | The failure to differentiate the two helps explain a few problems | |
46 | with the CFI generated by GCC. */ | |
47 | DWARF2_FRAME_REG_UNDEFINED, | |
48 | DWARF2_FRAME_REG_SAVED_OFFSET, | |
49 | DWARF2_FRAME_REG_SAVED_REG, | |
50 | DWARF2_FRAME_REG_SAVED_EXP, | |
51 | DWARF2_FRAME_REG_SAME_VALUE, | |
52 | ||
46ea248b AO |
53 | /* These are defined in Dwarf3. */ |
54 | DWARF2_FRAME_REG_SAVED_VAL_OFFSET, | |
55 | DWARF2_FRAME_REG_SAVED_VAL_EXP, | |
56 | ||
05cbe71a MK |
57 | /* These aren't defined by the DWARF2 CFI specification, but are |
58 | used internally by GDB. */ | |
b39cc962 | 59 | DWARF2_FRAME_REG_FN, /* Call a registered function. */ |
05cbe71a | 60 | DWARF2_FRAME_REG_RA, /* Return Address. */ |
8d5a9abc | 61 | DWARF2_FRAME_REG_RA_OFFSET, /* Return Address with offset. */ |
ea7963f0 FR |
62 | DWARF2_FRAME_REG_CFA, /* Call Frame Address. */ |
63 | DWARF2_FRAME_REG_CFA_OFFSET /* Call Frame Address with offset. */ | |
05cbe71a MK |
64 | }; |
65 | ||
66 | /* Register state. */ | |
67 | ||
68 | struct dwarf2_frame_state_reg | |
69 | { | |
70 | /* Each register save state can be described in terms of a CFA slot, | |
71 | another register, or a location expression. */ | |
72 | union { | |
73 | LONGEST offset; | |
74 | ULONGEST reg; | |
0d45f56e | 75 | const gdb_byte *exp; |
b39cc962 DJ |
76 | struct value *(*fn) (struct frame_info *this_frame, void **this_cache, |
77 | int regnum); | |
05cbe71a MK |
78 | } loc; |
79 | ULONGEST exp_len; | |
80 | enum dwarf2_frame_reg_rule how; | |
81 | }; | |
82 | ||
8f22cb90 MK |
83 | /* Set the architecture-specific register state initialization |
84 | function for GDBARCH to INIT_REG. */ | |
85 | ||
86 | extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, | |
87 | void (*init_reg) (struct gdbarch *, int, | |
aff37fc1 DM |
88 | struct dwarf2_frame_state_reg *, |
89 | struct frame_info *)); | |
8f22cb90 | 90 | |
3ed09a32 DJ |
91 | /* Set the architecture-specific signal trampoline recognition |
92 | function for GDBARCH to SIGNAL_FRAME_P. */ | |
93 | ||
94 | extern void | |
95 | dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch, | |
96 | int (*signal_frame_p) (struct gdbarch *, | |
97 | struct frame_info *)); | |
98 | ||
4fc771b8 DJ |
99 | /* Set the architecture-specific adjustment of .eh_frame and .debug_frame |
100 | register numbers. */ | |
4bf8967c AS |
101 | |
102 | extern void | |
4fc771b8 DJ |
103 | dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch, |
104 | int (*adjust_regnum) (struct gdbarch *, | |
105 | int, int)); | |
4bf8967c | 106 | |
4a4e5149 | 107 | /* Append the DWARF-2 frame unwinders to GDBARCH's list. */ |
cfc14b3a | 108 | |
4a4e5149 | 109 | void dwarf2_append_unwinders (struct gdbarch *gdbarch); |
cfc14b3a MK |
110 | |
111 | /* Return the frame base methods for the function that contains PC, or | |
112 | NULL if it can't be handled by the DWARF CFI frame unwinder. */ | |
113 | ||
05cbe71a | 114 | extern const struct frame_base * |
4a4e5149 | 115 | dwarf2_frame_base_sniffer (struct frame_info *this_frame); |
cfc14b3a MK |
116 | |
117 | /* Register the DWARF CFI for OBJFILE. */ | |
118 | ||
119 | void dwarf2_frame_build_info (struct objfile *objfile); | |
120 | ||
e7802207 TT |
121 | /* Compute the DWARF CFA for a frame. */ |
122 | ||
123 | CORE_ADDR dwarf2_frame_cfa (struct frame_info *this_frame); | |
124 | ||
cfc14b3a | 125 | #endif /* dwarf2-frame.h */ |