1 /* dwarf.h - DWARF support header file
2 Copyright (C) 2005-2015 Free Software Foundation, Inc.
4 This file is part of GNU Binutils.
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.
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.
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. */
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
;
25 /* Structure found in the .debug_line section. */
29 unsigned short li_version
;
30 dwarf_vma li_prologue_length
;
31 unsigned char li_min_insn_length
;
32 unsigned char li_max_ops_per_insn
;
33 unsigned char li_default_is_stmt
;
35 unsigned char li_line_range
;
36 unsigned char li_opcode_base
;
38 DWARF2_Internal_LineInfo
;
40 /* Structure found in .debug_pubnames section. */
44 unsigned short pn_version
;
48 DWARF2_Internal_PubNames
;
50 /* Structure found in .debug_info section. */
54 unsigned short cu_version
;
55 dwarf_vma cu_abbrev_offset
;
56 unsigned char cu_pointer_size
;
58 DWARF2_Internal_CompUnit
;
60 /* Structure found in .debug_aranges section. */
64 unsigned short ar_version
;
65 dwarf_vma ar_info_offset
;
66 unsigned char ar_pointer_size
;
67 unsigned char ar_segment_size
;
69 DWARF2_Internal_ARange
;
71 /* N.B. The order here must match the order in debug_displays. */
73 enum dwarf_section_display_enum
116 /* A debug section has a different name when it's stored compressed
117 or not. COMPRESSED_NAME and UNCOMPRESSED_NAME are the two
118 possibilities. NAME is set to whichever one is used for this
119 input file, as determined by load_debug_section(). */
120 const char *uncompressed_name
;
121 const char *compressed_name
;
123 unsigned char *start
;
125 dwarf_size_type size
;
126 enum dwarf_section_display_enum abbrev_sec
;
127 /* A spare field for random use. */
131 /* A structure containing the name of a debug section
132 and a pointer to a function that can decode it. */
133 struct dwarf_section_display
135 struct dwarf_section section
;
136 int (*display
) (struct dwarf_section
*, void *);
138 unsigned int relocate
: 1;
141 extern struct dwarf_section_display debug_displays
[];
143 /* This structure records the information that
144 we extract from the.debug_info section. */
147 unsigned int pointer_size
;
148 unsigned int offset_size
;
151 dwarf_vma base_address
;
152 /* This field is filled in when reading the attribute DW_AT_GNU_addr_base and
153 is used with the form DW_AT_GNU_FORM_addr_index. */
155 /* This field is filled in when reading the attribute DW_AT_GNU_ranges_base and
156 is used when calculating ranges. */
157 dwarf_vma ranges_base
;
158 /* This is an array of offsets to the location list table. */
159 dwarf_vma
* loc_offsets
;
160 int * have_frame_base
;
161 unsigned int num_loc_offsets
;
162 unsigned int max_loc_offsets
;
163 /* List of .debug_ranges offsets seen in this .debug_info. */
164 dwarf_vma
* range_lists
;
165 unsigned int num_range_lists
;
166 unsigned int max_range_lists
;
170 extern unsigned int eh_addr_size
;
172 extern int do_debug_info
;
173 extern int do_debug_abbrevs
;
174 extern int do_debug_lines
;
175 extern int do_debug_pubnames
;
176 extern int do_debug_pubtypes
;
177 extern int do_debug_aranges
;
178 extern int do_debug_ranges
;
179 extern int do_debug_frames
;
180 extern int do_debug_frames_interp
;
181 extern int do_debug_macinfo
;
182 extern int do_debug_str
;
183 extern int do_debug_loc
;
184 extern int do_gdb_index
;
185 extern int do_trace_info
;
186 extern int do_trace_abbrevs
;
187 extern int do_trace_aranges
;
188 extern int do_debug_addr
;
189 extern int do_debug_cu_index
;
192 extern int dwarf_cutoff_level
;
193 extern unsigned long dwarf_start_die
;
195 extern int dwarf_check
;
197 extern void init_dwarf_regnames (unsigned int);
198 extern void init_dwarf_regnames_i386 (void);
199 extern void init_dwarf_regnames_x86_64 (void);
200 extern void init_dwarf_regnames_aarch64 (void);
202 extern int load_debug_section (enum dwarf_section_display_enum
, void *);
203 extern void free_debug_section (enum dwarf_section_display_enum
);
205 extern void free_debug_memory (void);
207 extern void dwarf_select_sections_by_names (const char *);
208 extern void dwarf_select_sections_by_letters (const char *);
209 extern void dwarf_select_sections_all (void);
211 extern unsigned int * find_cu_tu_set (void *, unsigned int);
213 extern void * cmalloc (size_t, size_t);
214 extern void * xcalloc2 (size_t, size_t);
215 extern void * xcmalloc (size_t, size_t);
216 extern void * xcrealloc (void *, size_t, size_t);
218 extern dwarf_vma
read_leb128 (unsigned char *, unsigned int *, bfd_boolean
, const unsigned char * const);