]>
Commit | Line | Data |
---|---|---|
1b315056 | 1 | /* dwarf.h - DWARF support header file |
f6f0e17b | 2 | Copyright 2005-2013 Free Software Foundation, Inc. |
19e6b90e | 3 | |
32866df7 | 4 | This file is part of GNU Binutils. |
19e6b90e | 5 | |
32866df7 NC |
6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3 of the License, or | |
9 | (at your option) any later version. | |
19e6b90e | 10 | |
32866df7 NC |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
19e6b90e | 15 | |
32866df7 NC |
16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
19 | MA 02110-1301, USA. */ | |
19e6b90e | 20 | |
467c65bc NC |
21 | typedef unsigned HOST_WIDEST_INT dwarf_vma; |
22 | typedef HOST_WIDEST_INT dwarf_signed_vma; | |
23 | typedef unsigned HOST_WIDEST_INT dwarf_size_type; | |
19e6b90e | 24 | |
47704ddf KT |
25 | /* Structure found in the .debug_line section. */ |
26 | typedef struct | |
27 | { | |
28 | unsigned char li_length [4]; | |
29 | unsigned char li_version [2]; | |
30 | unsigned char li_prologue_length [4]; | |
31 | unsigned char li_min_insn_length [1]; | |
32 | unsigned char li_default_is_stmt [1]; | |
33 | unsigned char li_line_base [1]; | |
34 | unsigned char li_line_range [1]; | |
35 | unsigned char li_opcode_base [1]; | |
36 | } | |
37 | DWARF2_External_LineInfo; | |
38 | ||
39 | typedef struct | |
40 | { | |
467c65bc | 41 | dwarf_vma li_length; |
47704ddf KT |
42 | unsigned short li_version; |
43 | unsigned int li_prologue_length; | |
44 | unsigned char li_min_insn_length; | |
45 | unsigned char li_max_ops_per_insn; | |
46 | unsigned char li_default_is_stmt; | |
47 | int li_line_base; | |
48 | unsigned char li_line_range; | |
49 | unsigned char li_opcode_base; | |
50 | } | |
51 | DWARF2_Internal_LineInfo; | |
52 | ||
53 | /* Structure found in .debug_pubnames section. */ | |
54 | typedef struct | |
55 | { | |
56 | unsigned char pn_length [4]; | |
57 | unsigned char pn_version [2]; | |
58 | unsigned char pn_offset [4]; | |
59 | unsigned char pn_size [4]; | |
60 | } | |
61 | DWARF2_External_PubNames; | |
62 | ||
63 | typedef struct | |
64 | { | |
467c65bc | 65 | dwarf_vma pn_length; |
47704ddf | 66 | unsigned short pn_version; |
467c65bc NC |
67 | dwarf_vma pn_offset; |
68 | dwarf_vma pn_size; | |
47704ddf KT |
69 | } |
70 | DWARF2_Internal_PubNames; | |
71 | ||
72 | /* Structure found in .debug_info section. */ | |
73 | typedef struct | |
74 | { | |
75 | unsigned char cu_length [4]; | |
76 | unsigned char cu_version [2]; | |
77 | unsigned char cu_abbrev_offset [4]; | |
78 | unsigned char cu_pointer_size [1]; | |
79 | } | |
80 | DWARF2_External_CompUnit; | |
81 | ||
82 | typedef struct | |
83 | { | |
467c65bc | 84 | dwarf_vma cu_length; |
47704ddf | 85 | unsigned short cu_version; |
467c65bc | 86 | dwarf_vma cu_abbrev_offset; |
47704ddf KT |
87 | unsigned char cu_pointer_size; |
88 | } | |
89 | DWARF2_Internal_CompUnit; | |
90 | ||
91 | typedef struct | |
92 | { | |
93 | unsigned char ar_length [4]; | |
94 | unsigned char ar_version [2]; | |
95 | unsigned char ar_info_offset [4]; | |
96 | unsigned char ar_pointer_size [1]; | |
97 | unsigned char ar_segment_size [1]; | |
98 | } | |
99 | DWARF2_External_ARange; | |
100 | ||
101 | typedef struct | |
102 | { | |
467c65bc | 103 | dwarf_vma ar_length; |
47704ddf | 104 | unsigned short ar_version; |
467c65bc | 105 | dwarf_vma ar_info_offset; |
47704ddf KT |
106 | unsigned char ar_pointer_size; |
107 | unsigned char ar_segment_size; | |
108 | } | |
109 | DWARF2_Internal_ARange; | |
110 | ||
c34f4fc6 NC |
111 | enum dwarf_section_display_enum |
112 | { | |
19e6b90e L |
113 | abbrev = 0, |
114 | aranges, | |
115 | frame, | |
116 | info, | |
117 | line, | |
118 | pubnames, | |
119 | eh_frame, | |
120 | macinfo, | |
4ccf1e31 | 121 | macro, |
19e6b90e L |
122 | str, |
123 | loc, | |
124 | pubtypes, | |
125 | ranges, | |
126 | static_func, | |
127 | static_vars, | |
128 | types, | |
129 | weaknames, | |
48049d1e | 130 | gdb_index, |
6f875884 TG |
131 | trace_info, |
132 | trace_abbrev, | |
133 | trace_aranges, | |
4723351a CC |
134 | info_dwo, |
135 | abbrev_dwo, | |
136 | types_dwo, | |
137 | line_dwo, | |
138 | loc_dwo, | |
139 | macro_dwo, | |
140 | macinfo_dwo, | |
141 | str_dwo, | |
142 | str_index, | |
143 | str_index_dwo, | |
144 | debug_addr, | |
657d0d47 CC |
145 | dwp_cu_index, |
146 | dwp_tu_index, | |
19e6b90e L |
147 | max |
148 | }; | |
149 | ||
4723351a CC |
150 | struct dwarf_section |
151 | { | |
152 | /* A debug section has a different name when it's stored compressed | |
153 | or not. COMPRESSED_NAME and UNCOMPRESSED_NAME are the two | |
154 | possibilities. NAME is set to whichever one is used for this | |
155 | input file, as determined by load_debug_section(). */ | |
156 | const char *uncompressed_name; | |
157 | const char *compressed_name; | |
158 | const char *name; | |
159 | unsigned char *start; | |
160 | dwarf_vma address; | |
161 | dwarf_size_type size; | |
162 | enum dwarf_section_display_enum abbrev_sec; | |
163 | }; | |
164 | ||
165 | /* A structure containing the name of a debug section | |
166 | and a pointer to a function that can decode it. */ | |
167 | struct dwarf_section_display | |
168 | { | |
169 | struct dwarf_section section; | |
170 | int (*display) (struct dwarf_section *, void *); | |
171 | int *enabled; | |
172 | unsigned int relocate : 1; | |
173 | }; | |
174 | ||
19e6b90e L |
175 | extern struct dwarf_section_display debug_displays []; |
176 | ||
177 | /* This structure records the information that | |
178 | we extract from the.debug_info section. */ | |
179 | typedef struct | |
180 | { | |
181 | unsigned int pointer_size; | |
b7807392 JJ |
182 | unsigned int offset_size; |
183 | int dwarf_version; | |
467c65bc NC |
184 | dwarf_vma cu_offset; |
185 | dwarf_vma base_address; | |
4723351a CC |
186 | /* This field is filled in when reading the attribute DW_AT_GNU_addr_base and |
187 | is used with the form DW_AT_GNU_FORM_addr_index. */ | |
188 | dwarf_vma addr_base; | |
189 | /* This field is filled in when reading the attribute DW_AT_GNU_ranges_base and | |
190 | is used when calculating ranges. */ | |
191 | dwarf_vma ranges_base; | |
19e6b90e | 192 | /* This is an array of offsets to the location list table. */ |
467c65bc NC |
193 | dwarf_vma * loc_offsets; |
194 | int * have_frame_base; | |
19e6b90e L |
195 | unsigned int num_loc_offsets; |
196 | unsigned int max_loc_offsets; | |
01a8f077 | 197 | /* List of .debug_ranges offsets seen in this .debug_info. */ |
467c65bc | 198 | dwarf_vma * range_lists; |
19e6b90e L |
199 | unsigned int num_range_lists; |
200 | unsigned int max_range_lists; | |
201 | } | |
202 | debug_info; | |
203 | ||
2dc4cec1 | 204 | extern int eh_addr_size; |
19e6b90e L |
205 | |
206 | extern int do_debug_info; | |
207 | extern int do_debug_abbrevs; | |
208 | extern int do_debug_lines; | |
209 | extern int do_debug_pubnames; | |
f9f0e732 | 210 | extern int do_debug_pubtypes; |
19e6b90e L |
211 | extern int do_debug_aranges; |
212 | extern int do_debug_ranges; | |
213 | extern int do_debug_frames; | |
214 | extern int do_debug_frames_interp; | |
215 | extern int do_debug_macinfo; | |
216 | extern int do_debug_str; | |
217 | extern int do_debug_loc; | |
5bbdf3d5 | 218 | extern int do_gdb_index; |
6f875884 TG |
219 | extern int do_trace_info; |
220 | extern int do_trace_abbrevs; | |
221 | extern int do_trace_aranges; | |
657d0d47 CC |
222 | extern int do_debug_addr; |
223 | extern int do_debug_cu_index; | |
c34f4fc6 | 224 | extern int do_wide; |
19e6b90e | 225 | |
fd2f0033 TT |
226 | extern int dwarf_cutoff_level; |
227 | extern unsigned long dwarf_start_die; | |
228 | ||
4723351a CC |
229 | extern int dwarf_check; |
230 | ||
2dc4cec1 | 231 | extern void init_dwarf_regnames (unsigned int); |
b129eb0e RH |
232 | extern void init_dwarf_regnames_i386 (void); |
233 | extern void init_dwarf_regnames_x86_64 (void); | |
2dc4cec1 | 234 | |
467c65bc | 235 | extern int load_debug_section (enum dwarf_section_display_enum, void *); |
19e6b90e L |
236 | extern void free_debug_section (enum dwarf_section_display_enum); |
237 | ||
238 | extern void free_debug_memory (void); | |
239 | ||
c34f4fc6 NC |
240 | extern void dwarf_select_sections_by_names (const char *); |
241 | extern void dwarf_select_sections_by_letters (const char *); | |
4cb93e3b TG |
242 | extern void dwarf_select_sections_all (void); |
243 | ||
657d0d47 CC |
244 | unsigned int * find_cu_tu_set (void *, unsigned int); |
245 | ||
467c65bc NC |
246 | void * cmalloc (size_t, size_t); |
247 | void * xcmalloc (size_t, size_t); | |
248 | void * xcrealloc (void *, size_t, size_t); | |
19e6b90e | 249 | |
f6f0e17b | 250 | extern dwarf_vma read_leb128 (unsigned char *, unsigned int *, bfd_boolean, const unsigned char * const); |