1 /* dwarf.h - DWARF support header file
2 Copyright 2005, 2007, 2008, 2009, 2010, 2011
3 Free Software Foundation, Inc.
5 This file is part of GNU Binutils.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
22 typedef unsigned HOST_WIDEST_INT dwarf_vma
;
23 typedef HOST_WIDEST_INT dwarf_signed_vma
;
24 typedef unsigned HOST_WIDEST_INT dwarf_size_type
;
26 /* Structure found in the .debug_line section. */
29 unsigned char li_length
[4];
30 unsigned char li_version
[2];
31 unsigned char li_prologue_length
[4];
32 unsigned char li_min_insn_length
[1];
33 unsigned char li_default_is_stmt
[1];
34 unsigned char li_line_base
[1];
35 unsigned char li_line_range
[1];
36 unsigned char li_opcode_base
[1];
38 DWARF2_External_LineInfo
;
43 unsigned short li_version
;
44 unsigned int li_prologue_length
;
45 unsigned char li_min_insn_length
;
46 unsigned char li_max_ops_per_insn
;
47 unsigned char li_default_is_stmt
;
49 unsigned char li_line_range
;
50 unsigned char li_opcode_base
;
52 DWARF2_Internal_LineInfo
;
54 /* Structure found in .debug_pubnames section. */
57 unsigned char pn_length
[4];
58 unsigned char pn_version
[2];
59 unsigned char pn_offset
[4];
60 unsigned char pn_size
[4];
62 DWARF2_External_PubNames
;
67 unsigned short pn_version
;
71 DWARF2_Internal_PubNames
;
73 /* Structure found in .debug_info section. */
76 unsigned char cu_length
[4];
77 unsigned char cu_version
[2];
78 unsigned char cu_abbrev_offset
[4];
79 unsigned char cu_pointer_size
[1];
81 DWARF2_External_CompUnit
;
86 unsigned short cu_version
;
87 dwarf_vma cu_abbrev_offset
;
88 unsigned char cu_pointer_size
;
90 DWARF2_Internal_CompUnit
;
94 unsigned char ar_length
[4];
95 unsigned char ar_version
[2];
96 unsigned char ar_info_offset
[4];
97 unsigned char ar_pointer_size
[1];
98 unsigned char ar_segment_size
[1];
100 DWARF2_External_ARange
;
105 unsigned short ar_version
;
106 dwarf_vma ar_info_offset
;
107 unsigned char ar_pointer_size
;
108 unsigned char ar_segment_size
;
110 DWARF2_Internal_ARange
;
112 enum dwarf_section_display_enum
153 /* A debug section has a different name when it's stored compressed
154 or not. COMPRESSED_NAME and UNCOMPRESSED_NAME are the two
155 possibilities. NAME is set to whichever one is used for this
156 input file, as determined by load_debug_section(). */
157 const char *uncompressed_name
;
158 const char *compressed_name
;
160 unsigned char *start
;
162 dwarf_size_type size
;
163 enum dwarf_section_display_enum abbrev_sec
;
166 /* A structure containing the name of a debug section
167 and a pointer to a function that can decode it. */
168 struct dwarf_section_display
170 struct dwarf_section section
;
171 int (*display
) (struct dwarf_section
*, void *);
173 unsigned int relocate
: 1;
176 extern struct dwarf_section_display debug_displays
[];
178 /* This structure records the information that
179 we extract from the.debug_info section. */
182 unsigned int pointer_size
;
183 unsigned int offset_size
;
186 dwarf_vma base_address
;
187 /* This field is filled in when reading the attribute DW_AT_GNU_addr_base and
188 is used with the form DW_AT_GNU_FORM_addr_index. */
190 /* This field is filled in when reading the attribute DW_AT_GNU_ranges_base and
191 is used when calculating ranges. */
192 dwarf_vma ranges_base
;
193 /* This is an array of offsets to the location list table. */
194 dwarf_vma
* loc_offsets
;
195 int * have_frame_base
;
196 unsigned int num_loc_offsets
;
197 unsigned int max_loc_offsets
;
198 /* List of .debug_ranges offsets seen in this .debug_info. */
199 dwarf_vma
* range_lists
;
200 unsigned int num_range_lists
;
201 unsigned int max_range_lists
;
205 extern int eh_addr_size
;
207 extern int do_debug_info
;
208 extern int do_debug_abbrevs
;
209 extern int do_debug_lines
;
210 extern int do_debug_pubnames
;
211 extern int do_debug_pubtypes
;
212 extern int do_debug_aranges
;
213 extern int do_debug_ranges
;
214 extern int do_debug_frames
;
215 extern int do_debug_frames_interp
;
216 extern int do_debug_macinfo
;
217 extern int do_debug_str
;
218 extern int do_debug_loc
;
219 extern int do_gdb_index
;
220 extern int do_trace_info
;
221 extern int do_trace_abbrevs
;
222 extern int do_trace_aranges
;
223 extern int do_debug_addr
;
224 extern int do_debug_cu_index
;
227 extern int dwarf_cutoff_level
;
228 extern unsigned long dwarf_start_die
;
230 extern int dwarf_check
;
232 extern void init_dwarf_regnames (unsigned int);
233 extern void init_dwarf_regnames_i386 (void);
234 extern void init_dwarf_regnames_x86_64 (void);
236 extern int load_debug_section (enum dwarf_section_display_enum
, void *);
237 extern void free_debug_section (enum dwarf_section_display_enum
);
239 extern void free_debug_memory (void);
241 extern void dwarf_select_sections_by_names (const char *);
242 extern void dwarf_select_sections_by_letters (const char *);
243 extern void dwarf_select_sections_all (void);
245 unsigned int * find_cu_tu_set (void *, unsigned int);
247 void * cmalloc (size_t, size_t);
248 void * xcmalloc (size_t, size_t);
249 void * xcrealloc (void *, size_t, size_t);
251 dwarf_vma
read_leb128 (unsigned char *, unsigned int *, int);