2011-02-26 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / dwarf2-frame.h
1 /* Frame unwinder for frames with DWARF Call Frame Information.
2
3 Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
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
12 the Free Software Foundation; either version 3 of the License, or
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
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22
23 #ifndef DWARF2_FRAME_H
24 #define DWARF2_FRAME_H 1
25
26 struct gdbarch;
27 struct objfile;
28 struct frame_info;
29 struct dwarf2_per_cu_data;
30 struct agent_expr;
31 struct axs_value;
32
33 /* Register rule. */
34
35 enum dwarf2_frame_reg_rule
36 {
37 /* Make certain that 0 maps onto the correct enum value; the
38 corresponding structure is being initialized using memset zero.
39 This indicates that CFI didn't provide any information at all
40 about a register, leaving how to obtain its value totally
41 unspecified. */
42 DWARF2_FRAME_REG_UNSPECIFIED = 0,
43
44 /* The term "undefined" comes from the DWARF2 CFI spec which this
45 code is moddeling; it indicates that the register's value is
46 "undefined". GCC uses the less formal term "unsaved". Its
47 definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED.
48 The failure to differentiate the two helps explain a few problems
49 with the CFI generated by GCC. */
50 DWARF2_FRAME_REG_UNDEFINED,
51 DWARF2_FRAME_REG_SAVED_OFFSET,
52 DWARF2_FRAME_REG_SAVED_REG,
53 DWARF2_FRAME_REG_SAVED_EXP,
54 DWARF2_FRAME_REG_SAME_VALUE,
55
56 /* These are defined in Dwarf3. */
57 DWARF2_FRAME_REG_SAVED_VAL_OFFSET,
58 DWARF2_FRAME_REG_SAVED_VAL_EXP,
59
60 /* These aren't defined by the DWARF2 CFI specification, but are
61 used internally by GDB. */
62 DWARF2_FRAME_REG_FN, /* Call a registered function. */
63 DWARF2_FRAME_REG_RA, /* Return Address. */
64 DWARF2_FRAME_REG_RA_OFFSET, /* Return Address with offset. */
65 DWARF2_FRAME_REG_CFA, /* Call Frame Address. */
66 DWARF2_FRAME_REG_CFA_OFFSET /* Call Frame Address with offset. */
67 };
68
69 /* Register state. */
70
71 struct dwarf2_frame_state_reg
72 {
73 /* Each register save state can be described in terms of a CFA slot,
74 another register, or a location expression. */
75 union {
76 LONGEST offset;
77 ULONGEST reg;
78 const gdb_byte *exp;
79 struct value *(*fn) (struct frame_info *this_frame, void **this_cache,
80 int regnum);
81 } loc;
82 ULONGEST exp_len;
83 enum dwarf2_frame_reg_rule how;
84 };
85
86 /* Set the architecture-specific register state initialization
87 function for GDBARCH to INIT_REG. */
88
89 extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch,
90 void (*init_reg) (struct gdbarch *, int,
91 struct dwarf2_frame_state_reg *,
92 struct frame_info *));
93
94 /* Set the architecture-specific signal trampoline recognition
95 function for GDBARCH to SIGNAL_FRAME_P. */
96
97 extern void
98 dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
99 int (*signal_frame_p) (struct gdbarch *,
100 struct frame_info *));
101
102 /* Set the architecture-specific adjustment of .eh_frame and .debug_frame
103 register numbers. */
104
105 extern void
106 dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
107 int (*adjust_regnum) (struct gdbarch *,
108 int, int));
109
110 /* Append the DWARF-2 frame unwinders to GDBARCH's list. */
111
112 void dwarf2_append_unwinders (struct gdbarch *gdbarch);
113
114 /* Return the frame base methods for the function that contains PC, or
115 NULL if it can't be handled by the DWARF CFI frame unwinder. */
116
117 extern const struct frame_base *
118 dwarf2_frame_base_sniffer (struct frame_info *this_frame);
119
120 /* Compute the DWARF CFA for a frame. */
121
122 CORE_ADDR dwarf2_frame_cfa (struct frame_info *this_frame);
123
124 /* Update the agent expression EXPR with code to compute the CFA for a
125 frame at PC. GDBARCH is the architecture of the function at PC.
126 This function may call dwarf2_compile_expr_to_ax; DATA is passed
127 through to that function if needed. */
128
129 extern void dwarf2_compile_cfa_to_ax (struct agent_expr *expr,
130 struct axs_value *loc,
131 struct gdbarch *gdbarch,
132 CORE_ADDR pc,
133 struct dwarf2_per_cu_data *data);
134
135 #endif /* dwarf2-frame.h */
This page took 0.03258 seconds and 4 git commands to generate.