binutils/
[deliverable/binutils-gdb.git] / binutils / dwarf.h
CommitLineData
1b315056 1/* dwarf.h - DWARF support header file
467c65bc 2 Copyright 2005, 2007, 2008, 2009, 2010, 2011
19e6b90e
L
3 Free Software Foundation, Inc.
4
32866df7 5 This file is part of GNU Binutils.
19e6b90e 6
32866df7
NC
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.
19e6b90e 11
32866df7
NC
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.
19e6b90e 16
32866df7
NC
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. */
19e6b90e 21
467c65bc
NC
22typedef unsigned HOST_WIDEST_INT dwarf_vma;
23typedef HOST_WIDEST_INT dwarf_signed_vma;
24typedef unsigned HOST_WIDEST_INT dwarf_size_type;
19e6b90e 25
47704ddf
KT
26/* Structure found in the .debug_line section. */
27typedef struct
28{
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];
37}
38DWARF2_External_LineInfo;
39
40typedef struct
41{
467c65bc 42 dwarf_vma li_length;
47704ddf
KT
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;
48 int li_line_base;
49 unsigned char li_line_range;
50 unsigned char li_opcode_base;
51}
52DWARF2_Internal_LineInfo;
53
54/* Structure found in .debug_pubnames section. */
55typedef struct
56{
57 unsigned char pn_length [4];
58 unsigned char pn_version [2];
59 unsigned char pn_offset [4];
60 unsigned char pn_size [4];
61}
62DWARF2_External_PubNames;
63
64typedef struct
65{
467c65bc 66 dwarf_vma pn_length;
47704ddf 67 unsigned short pn_version;
467c65bc
NC
68 dwarf_vma pn_offset;
69 dwarf_vma pn_size;
47704ddf
KT
70}
71DWARF2_Internal_PubNames;
72
73/* Structure found in .debug_info section. */
74typedef struct
75{
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];
80}
81DWARF2_External_CompUnit;
82
83typedef struct
84{
467c65bc 85 dwarf_vma cu_length;
47704ddf 86 unsigned short cu_version;
467c65bc 87 dwarf_vma cu_abbrev_offset;
47704ddf
KT
88 unsigned char cu_pointer_size;
89}
90DWARF2_Internal_CompUnit;
91
92typedef struct
93{
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];
99}
100DWARF2_External_ARange;
101
102typedef struct
103{
467c65bc 104 dwarf_vma ar_length;
47704ddf 105 unsigned short ar_version;
467c65bc 106 dwarf_vma ar_info_offset;
47704ddf
KT
107 unsigned char ar_pointer_size;
108 unsigned char ar_segment_size;
109}
110DWARF2_Internal_ARange;
111
c34f4fc6
NC
112enum dwarf_section_display_enum
113{
19e6b90e
L
114 abbrev = 0,
115 aranges,
116 frame,
117 info,
118 line,
119 pubnames,
120 eh_frame,
121 macinfo,
4ccf1e31 122 macro,
19e6b90e
L
123 str,
124 loc,
125 pubtypes,
126 ranges,
127 static_func,
128 static_vars,
129 types,
130 weaknames,
48049d1e 131 gdb_index,
6f875884
TG
132 trace_info,
133 trace_abbrev,
134 trace_aranges,
4723351a
CC
135 info_dwo,
136 abbrev_dwo,
137 types_dwo,
138 line_dwo,
139 loc_dwo,
140 macro_dwo,
141 macinfo_dwo,
142 str_dwo,
143 str_index,
144 str_index_dwo,
145 debug_addr,
657d0d47
CC
146 dwp_cu_index,
147 dwp_tu_index,
19e6b90e
L
148 max
149};
150
4723351a
CC
151struct dwarf_section
152{
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;
159 const char *name;
160 unsigned char *start;
161 dwarf_vma address;
162 dwarf_size_type size;
163 enum dwarf_section_display_enum abbrev_sec;
164};
165
166/* A structure containing the name of a debug section
167 and a pointer to a function that can decode it. */
168struct dwarf_section_display
169{
170 struct dwarf_section section;
171 int (*display) (struct dwarf_section *, void *);
172 int *enabled;
173 unsigned int relocate : 1;
174};
175
19e6b90e
L
176extern struct dwarf_section_display debug_displays [];
177
178/* This structure records the information that
179 we extract from the.debug_info section. */
180typedef struct
181{
182 unsigned int pointer_size;
b7807392
JJ
183 unsigned int offset_size;
184 int dwarf_version;
467c65bc
NC
185 dwarf_vma cu_offset;
186 dwarf_vma base_address;
4723351a
CC
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. */
189 dwarf_vma addr_base;
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;
19e6b90e 193 /* This is an array of offsets to the location list table. */
467c65bc
NC
194 dwarf_vma * loc_offsets;
195 int * have_frame_base;
19e6b90e
L
196 unsigned int num_loc_offsets;
197 unsigned int max_loc_offsets;
01a8f077 198 /* List of .debug_ranges offsets seen in this .debug_info. */
467c65bc 199 dwarf_vma * range_lists;
19e6b90e
L
200 unsigned int num_range_lists;
201 unsigned int max_range_lists;
202}
203debug_info;
204
2dc4cec1 205extern int eh_addr_size;
19e6b90e
L
206
207extern int do_debug_info;
208extern int do_debug_abbrevs;
209extern int do_debug_lines;
210extern int do_debug_pubnames;
f9f0e732 211extern int do_debug_pubtypes;
19e6b90e
L
212extern int do_debug_aranges;
213extern int do_debug_ranges;
214extern int do_debug_frames;
215extern int do_debug_frames_interp;
216extern int do_debug_macinfo;
217extern int do_debug_str;
218extern int do_debug_loc;
5bbdf3d5 219extern int do_gdb_index;
6f875884
TG
220extern int do_trace_info;
221extern int do_trace_abbrevs;
222extern int do_trace_aranges;
657d0d47
CC
223extern int do_debug_addr;
224extern int do_debug_cu_index;
c34f4fc6 225extern int do_wide;
19e6b90e 226
fd2f0033
TT
227extern int dwarf_cutoff_level;
228extern unsigned long dwarf_start_die;
229
4723351a
CC
230extern int dwarf_check;
231
2dc4cec1 232extern void init_dwarf_regnames (unsigned int);
b129eb0e
RH
233extern void init_dwarf_regnames_i386 (void);
234extern void init_dwarf_regnames_x86_64 (void);
2dc4cec1 235
467c65bc 236extern int load_debug_section (enum dwarf_section_display_enum, void *);
19e6b90e
L
237extern void free_debug_section (enum dwarf_section_display_enum);
238
239extern void free_debug_memory (void);
240
c34f4fc6
NC
241extern void dwarf_select_sections_by_names (const char *);
242extern void dwarf_select_sections_by_letters (const char *);
4cb93e3b
TG
243extern void dwarf_select_sections_all (void);
244
657d0d47
CC
245unsigned int * find_cu_tu_set (void *, unsigned int);
246
467c65bc
NC
247void * cmalloc (size_t, size_t);
248void * xcmalloc (size_t, size_t);
249void * xcrealloc (void *, size_t, size_t);
19e6b90e 250
467c65bc 251dwarf_vma read_leb128 (unsigned char *, unsigned int *, int);
This page took 0.275661 seconds and 4 git commands to generate.