Commit | Line | Data |
---|---|---|
852483bc MK |
1 | /* DWARF 2 location expression support for GDB. |
2 | ||
7b6bb8da | 3 | Copyright (C) 2003, 2005, 2007, 2008, 2009, 2010, 2011 |
4c38e0a4 | 4 | Free Software Foundation, Inc. |
4c2df51b DJ |
5 | |
6 | This file is part of GDB. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 10 | the Free Software Foundation; either version 3 of the License, or |
4c2df51b DJ |
11 | (at your option) any later version. |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
4c2df51b DJ |
20 | |
21 | #if !defined (DWARF2LOC_H) | |
22 | #define DWARF2LOC_H | |
23 | ||
768a979c | 24 | struct symbol_computed_ops; |
ae0d2f24 UW |
25 | struct objfile; |
26 | struct dwarf2_per_cu_data; | |
8cf6f0b1 | 27 | struct dwarf2_loclist_baton; |
9f6f94ff TT |
28 | struct agent_expr; |
29 | struct axs_value; | |
a67af2b9 | 30 | |
4c2df51b DJ |
31 | /* This header is private to the DWARF-2 reader. It is shared between |
32 | dwarf2read.c and dwarf2loc.c. */ | |
33 | ||
9aa1f1e3 TT |
34 | /* Return the OBJFILE associated with the compilation unit CU. If CU |
35 | came from a separate debuginfo file, then the master objfile is | |
36 | returned. */ | |
ae0d2f24 UW |
37 | struct objfile *dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *cu); |
38 | ||
39 | /* Return the address size given in the compilation unit header for CU. */ | |
40 | CORE_ADDR dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *cu); | |
41 | ||
9eae7c52 TT |
42 | /* Return the offset size given in the compilation unit header for CU. */ |
43 | int dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *cu); | |
44 | ||
9aa1f1e3 TT |
45 | /* Return the text offset of the CU. The returned offset comes from |
46 | this CU's objfile. If this objfile came from a separate debuginfo | |
47 | file, then the offset may be different from the corresponding | |
48 | offset in the parent objfile. */ | |
49 | CORE_ADDR dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *cu); | |
50 | ||
8cf6f0b1 TT |
51 | /* Find a particular location expression from a location list. */ |
52 | const gdb_byte *dwarf2_find_location_expression | |
53 | (struct dwarf2_loclist_baton *baton, | |
54 | size_t *locexpr_length, | |
55 | CORE_ADDR pc); | |
56 | ||
5c631832 | 57 | struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block |
8cf6f0b1 TT |
58 | (unsigned int offset, struct dwarf2_per_cu_data *per_cu, |
59 | CORE_ADDR (*get_frame_pc) (void *baton), | |
60 | void *baton); | |
5c631832 | 61 | |
8a9b8146 TT |
62 | struct type *dwarf2_get_die_type (unsigned int die_offset, |
63 | struct dwarf2_per_cu_data *per_cu); | |
64 | ||
98bfdba5 PA |
65 | /* Evaluate a location description, starting at DATA and with length |
66 | SIZE, to find the current location of variable of TYPE in the context | |
67 | of FRAME. */ | |
68 | ||
69 | struct value *dwarf2_evaluate_loc_desc (struct type *type, | |
70 | struct frame_info *frame, | |
71 | const gdb_byte *data, | |
72 | unsigned short size, | |
73 | struct dwarf2_per_cu_data *per_cu); | |
74 | ||
0d53c4c4 DJ |
75 | /* The symbol location baton types used by the DWARF-2 reader (i.e. |
76 | SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct | |
77 | dwarf2_locexpr_baton" is for a symbol with a single location | |
78 | expression; "struct dwarf2_loclist_baton" is for a symbol with a | |
79 | location list. */ | |
4c2df51b DJ |
80 | |
81 | struct dwarf2_locexpr_baton | |
82 | { | |
0d53c4c4 | 83 | /* Pointer to the start of the location expression. */ |
947bb88f | 84 | const gdb_byte *data; |
0d53c4c4 DJ |
85 | |
86 | /* Length of the location expression. */ | |
607269ae | 87 | unsigned long size; |
0d53c4c4 | 88 | |
ae0d2f24 UW |
89 | /* The compilation unit containing the symbol whose location |
90 | we're computing. */ | |
91 | struct dwarf2_per_cu_data *per_cu; | |
0d53c4c4 DJ |
92 | }; |
93 | ||
94 | struct dwarf2_loclist_baton | |
95 | { | |
96 | /* The initial base address for the location list, based on the compilation | |
97 | unit. */ | |
98 | CORE_ADDR base_address; | |
99 | ||
100 | /* Pointer to the start of the location list. */ | |
947bb88f | 101 | const gdb_byte *data; |
0d53c4c4 DJ |
102 | |
103 | /* Length of the location list. */ | |
607269ae | 104 | unsigned long size; |
0d53c4c4 | 105 | |
ae0d2f24 UW |
106 | /* The compilation unit containing the symbol whose location |
107 | we're computing. */ | |
108 | struct dwarf2_per_cu_data *per_cu; | |
4c2df51b DJ |
109 | }; |
110 | ||
768a979c UW |
111 | extern const struct symbol_computed_ops dwarf2_locexpr_funcs; |
112 | extern const struct symbol_computed_ops dwarf2_loclist_funcs; | |
4c2df51b | 113 | |
9f6f94ff TT |
114 | /* Compile a DWARF location expression to an agent expression. |
115 | ||
116 | EXPR is the agent expression we are building. | |
117 | LOC is the agent value we modify. | |
118 | ARCH is the architecture. | |
119 | ADDR_SIZE is the size of addresses, in bytes. | |
120 | OP_PTR is the start of the location expression. | |
121 | OP_END is one past the last byte of the location expression. | |
122 | ||
123 | This will throw an exception for various kinds of errors -- for | |
124 | example, if the expression cannot be compiled, or if the expression | |
125 | is invalid. */ | |
126 | ||
127 | extern void dwarf2_compile_expr_to_ax (struct agent_expr *expr, | |
128 | struct axs_value *loc, | |
129 | struct gdbarch *arch, | |
130 | unsigned int addr_size, | |
131 | const gdb_byte *op_ptr, | |
132 | const gdb_byte *op_end, | |
133 | struct dwarf2_per_cu_data *per_cu); | |
134 | ||
852483bc | 135 | #endif /* dwarf2loc.h */ |