1cd4201649856b81db0cf55f3a6fe7994d9d481c
[deliverable/binutils-gdb.git] / binutils / dwarf.h
1 /* dwarf.h - DWARF support header file
2 Copyright 2005-2013 Free Software Foundation, Inc.
3
4 This file is part of GNU Binutils.
5
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.
10
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.
15
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. */
20
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;
24
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 {
41 dwarf_vma li_length;
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 {
65 dwarf_vma pn_length;
66 unsigned short pn_version;
67 dwarf_vma pn_offset;
68 dwarf_vma pn_size;
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 {
84 dwarf_vma cu_length;
85 unsigned short cu_version;
86 dwarf_vma cu_abbrev_offset;
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 {
103 dwarf_vma ar_length;
104 unsigned short ar_version;
105 dwarf_vma ar_info_offset;
106 unsigned char ar_pointer_size;
107 unsigned char ar_segment_size;
108 }
109 DWARF2_Internal_ARange;
110
111 /* N.B. The order here must match the order in debug_displays. */
112
113 enum dwarf_section_display_enum
114 {
115 abbrev = 0,
116 aranges,
117 frame,
118 info,
119 line,
120 pubnames,
121 gnu_pubnames,
122 eh_frame,
123 macinfo,
124 macro,
125 str,
126 loc,
127 pubtypes,
128 gnu_pubtypes,
129 ranges,
130 static_func,
131 static_vars,
132 types,
133 weaknames,
134 gdb_index,
135 trace_info,
136 trace_abbrev,
137 trace_aranges,
138 info_dwo,
139 abbrev_dwo,
140 types_dwo,
141 line_dwo,
142 loc_dwo,
143 macro_dwo,
144 macinfo_dwo,
145 str_dwo,
146 str_index,
147 str_index_dwo,
148 debug_addr,
149 dwp_cu_index,
150 dwp_tu_index,
151 max
152 };
153
154 struct dwarf_section
155 {
156 /* A debug section has a different name when it's stored compressed
157 or not. COMPRESSED_NAME and UNCOMPRESSED_NAME are the two
158 possibilities. NAME is set to whichever one is used for this
159 input file, as determined by load_debug_section(). */
160 const char *uncompressed_name;
161 const char *compressed_name;
162 const char *name;
163 unsigned char *start;
164 dwarf_vma address;
165 dwarf_size_type size;
166 enum dwarf_section_display_enum abbrev_sec;
167 };
168
169 /* A structure containing the name of a debug section
170 and a pointer to a function that can decode it. */
171 struct dwarf_section_display
172 {
173 struct dwarf_section section;
174 int (*display) (struct dwarf_section *, void *);
175 int *enabled;
176 unsigned int relocate : 1;
177 };
178
179 extern struct dwarf_section_display debug_displays [];
180
181 /* This structure records the information that
182 we extract from the.debug_info section. */
183 typedef struct
184 {
185 unsigned int pointer_size;
186 unsigned int offset_size;
187 int dwarf_version;
188 dwarf_vma cu_offset;
189 dwarf_vma base_address;
190 /* This field is filled in when reading the attribute DW_AT_GNU_addr_base and
191 is used with the form DW_AT_GNU_FORM_addr_index. */
192 dwarf_vma addr_base;
193 /* This field is filled in when reading the attribute DW_AT_GNU_ranges_base and
194 is used when calculating ranges. */
195 dwarf_vma ranges_base;
196 /* This is an array of offsets to the location list table. */
197 dwarf_vma * loc_offsets;
198 int * have_frame_base;
199 unsigned int num_loc_offsets;
200 unsigned int max_loc_offsets;
201 /* List of .debug_ranges offsets seen in this .debug_info. */
202 dwarf_vma * range_lists;
203 unsigned int num_range_lists;
204 unsigned int max_range_lists;
205 }
206 debug_info;
207
208 extern int eh_addr_size;
209
210 extern int do_debug_info;
211 extern int do_debug_abbrevs;
212 extern int do_debug_lines;
213 extern int do_debug_pubnames;
214 extern int do_debug_pubtypes;
215 extern int do_debug_aranges;
216 extern int do_debug_ranges;
217 extern int do_debug_frames;
218 extern int do_debug_frames_interp;
219 extern int do_debug_macinfo;
220 extern int do_debug_str;
221 extern int do_debug_loc;
222 extern int do_gdb_index;
223 extern int do_trace_info;
224 extern int do_trace_abbrevs;
225 extern int do_trace_aranges;
226 extern int do_debug_addr;
227 extern int do_debug_cu_index;
228 extern int do_wide;
229
230 extern int dwarf_cutoff_level;
231 extern unsigned long dwarf_start_die;
232
233 extern int dwarf_check;
234
235 extern void init_dwarf_regnames (unsigned int);
236 extern void init_dwarf_regnames_i386 (void);
237 extern void init_dwarf_regnames_x86_64 (void);
238
239 extern int load_debug_section (enum dwarf_section_display_enum, void *);
240 extern void free_debug_section (enum dwarf_section_display_enum);
241
242 extern void free_debug_memory (void);
243
244 extern void dwarf_select_sections_by_names (const char *);
245 extern void dwarf_select_sections_by_letters (const char *);
246 extern void dwarf_select_sections_all (void);
247
248 unsigned int * find_cu_tu_set (void *, unsigned int);
249
250 void * cmalloc (size_t, size_t);
251 void * xcmalloc (size_t, size_t);
252 void * xcrealloc (void *, size_t, size_t);
253
254 extern dwarf_vma read_leb128 (unsigned char *, unsigned int *, bfd_boolean, const unsigned char * const);
This page took 0.046188 seconds and 4 git commands to generate.