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