Commit | Line | Data |
---|---|---|
cfc14b3a MK |
1 | /* Frame unwinder for frames with DWARF Call Frame Information. |
2 | ||
197e01b6 | 3 | Copyright (C) 2003, 2004, 2005 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 | |
11 | the Free Software Foundation; either version 2 of the License, or | |
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 | |
20 | along with this program; if not, write to the Free Software | |
197e01b6 EZ |
21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 | Boston, MA 02110-1301, USA. */ | |
cfc14b3a MK |
23 | |
24 | #ifndef DWARF2_FRAME_H | |
25 | #define DWARF2_FRAME_H 1 | |
26 | ||
ecc9ac84 | 27 | struct gdbarch; |
cfc14b3a | 28 | struct objfile; |
e6e5e94c | 29 | struct frame_info; |
cfc14b3a | 30 | |
05cbe71a MK |
31 | /* Register rule. */ |
32 | ||
33 | enum dwarf2_frame_reg_rule | |
34 | { | |
35 | /* Make certain that 0 maps onto the correct enum value; the | |
36 | corresponding structure is being initialized using memset zero. | |
37 | This indicates that CFI didn't provide any information at all | |
38 | about a register, leaving how to obtain its value totally | |
39 | unspecified. */ | |
40 | DWARF2_FRAME_REG_UNSPECIFIED = 0, | |
41 | ||
42 | /* The term "undefined" comes from the DWARF2 CFI spec which this | |
43 | code is moddeling; it indicates that the register's value is | |
44 | "undefined". GCC uses the less formal term "unsaved". Its | |
45 | definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED. | |
46 | The failure to differentiate the two helps explain a few problems | |
47 | with the CFI generated by GCC. */ | |
48 | DWARF2_FRAME_REG_UNDEFINED, | |
49 | DWARF2_FRAME_REG_SAVED_OFFSET, | |
50 | DWARF2_FRAME_REG_SAVED_REG, | |
51 | DWARF2_FRAME_REG_SAVED_EXP, | |
52 | DWARF2_FRAME_REG_SAME_VALUE, | |
53 | ||
46ea248b AO |
54 | /* These are defined in Dwarf3. */ |
55 | DWARF2_FRAME_REG_SAVED_VAL_OFFSET, | |
56 | DWARF2_FRAME_REG_SAVED_VAL_EXP, | |
57 | ||
05cbe71a MK |
58 | /* These aren't defined by the DWARF2 CFI specification, but are |
59 | used internally by GDB. */ | |
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; | |
75 | unsigned char *exp; | |
76 | } loc; | |
77 | ULONGEST exp_len; | |
78 | enum dwarf2_frame_reg_rule how; | |
79 | }; | |
80 | ||
8f22cb90 MK |
81 | /* Set the architecture-specific register state initialization |
82 | function for GDBARCH to INIT_REG. */ | |
83 | ||
84 | extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, | |
85 | void (*init_reg) (struct gdbarch *, int, | |
aff37fc1 DM |
86 | struct dwarf2_frame_state_reg *, |
87 | struct frame_info *)); | |
8f22cb90 | 88 | |
3ed09a32 DJ |
89 | /* Set the architecture-specific signal trampoline recognition |
90 | function for GDBARCH to SIGNAL_FRAME_P. */ | |
91 | ||
92 | extern void | |
93 | dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch, | |
94 | int (*signal_frame_p) (struct gdbarch *, | |
95 | struct frame_info *)); | |
96 | ||
4bf8967c AS |
97 | /* Set the architecture-specific mapping of .eh_frame register numbers to |
98 | DWARF register numbers. */ | |
99 | ||
100 | extern void | |
101 | dwarf2_frame_set_eh_frame_regnum (struct gdbarch *gdbarch, | |
102 | int (*eh_frame_regnum) (struct gdbarch *, | |
103 | int)); | |
104 | ||
105 | /* Translate a .eh_frame register to DWARF register. */ | |
106 | ||
107 | extern int | |
108 | dwarf2_frame_eh_frame_regnum (struct gdbarch *gdbarch, int regnum); | |
109 | ||
cfc14b3a MK |
110 | /* Return the frame unwind methods for the function that contains PC, |
111 | or NULL if it can't be handled by DWARF CFI frame unwinder. */ | |
112 | ||
05cbe71a MK |
113 | extern const struct frame_unwind * |
114 | dwarf2_frame_sniffer (struct frame_info *next_frame); | |
cfc14b3a MK |
115 | |
116 | /* Return the frame base methods for the function that contains PC, or | |
117 | NULL if it can't be handled by the DWARF CFI frame unwinder. */ | |
118 | ||
05cbe71a MK |
119 | extern const struct frame_base * |
120 | dwarf2_frame_base_sniffer (struct frame_info *next_frame); | |
cfc14b3a MK |
121 | |
122 | /* Register the DWARF CFI for OBJFILE. */ | |
123 | ||
124 | void dwarf2_frame_build_info (struct objfile *objfile); | |
125 | ||
126 | #endif /* dwarf2-frame.h */ |