binutils/
[deliverable/binutils-gdb.git] / binutils / dwarf.h
... / ...
CommitLineData
1/* dwarf.h - DWARF support header file
2 Copyright 2005, 2007, 2008, 2009, 2010, 2011
3 Free Software Foundation, Inc.
4
5 This file is part of GNU Binutils.
6
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.
11
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.
16
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. */
21
22typedef unsigned HOST_WIDEST_INT dwarf_vma;
23typedef HOST_WIDEST_INT dwarf_signed_vma;
24typedef unsigned HOST_WIDEST_INT dwarf_size_type;
25
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{
42 dwarf_vma li_length;
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{
66 dwarf_vma pn_length;
67 unsigned short pn_version;
68 dwarf_vma pn_offset;
69 dwarf_vma pn_size;
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{
85 dwarf_vma cu_length;
86 unsigned short cu_version;
87 dwarf_vma cu_abbrev_offset;
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{
104 dwarf_vma ar_length;
105 unsigned short ar_version;
106 dwarf_vma ar_info_offset;
107 unsigned char ar_pointer_size;
108 unsigned char ar_segment_size;
109}
110DWARF2_Internal_ARange;
111
112struct dwarf_section
113{
114 /* A debug section has a different name when it's stored compressed
115 or not. COMPRESSED_NAME and UNCOMPRESSED_NAME are the two
116 possibilities. NAME is set to whichever one is used for this
117 input file, as determined by load_debug_section(). */
118 const char *uncompressed_name;
119 const char *compressed_name;
120 const char *name;
121 unsigned char *start;
122 dwarf_vma address;
123 dwarf_size_type size;
124};
125
126/* A structure containing the name of a debug section
127 and a pointer to a function that can decode it. */
128struct dwarf_section_display
129{
130 struct dwarf_section section;
131 int (*display) (struct dwarf_section *, void *);
132 int *enabled;
133 unsigned int relocate : 1;
134};
135
136enum dwarf_section_display_enum
137{
138 abbrev = 0,
139 aranges,
140 frame,
141 info,
142 line,
143 pubnames,
144 eh_frame,
145 macinfo,
146 str,
147 loc,
148 pubtypes,
149 ranges,
150 static_func,
151 static_vars,
152 types,
153 weaknames,
154 trace_info,
155 trace_abbrev,
156 trace_aranges,
157 max
158};
159
160extern struct dwarf_section_display debug_displays [];
161
162/* This structure records the information that
163 we extract from the.debug_info section. */
164typedef struct
165{
166 unsigned int pointer_size;
167 unsigned int offset_size;
168 int dwarf_version;
169 dwarf_vma cu_offset;
170 dwarf_vma base_address;
171 /* This is an array of offsets to the location list table. */
172 dwarf_vma * loc_offsets;
173 int * have_frame_base;
174 unsigned int num_loc_offsets;
175 unsigned int max_loc_offsets;
176 /* List of .debug_ranges offsets seen in this .debug_info. */
177 dwarf_vma * range_lists;
178 unsigned int num_range_lists;
179 unsigned int max_range_lists;
180}
181debug_info;
182
183extern int eh_addr_size;
184
185extern int do_debug_info;
186extern int do_debug_abbrevs;
187extern int do_debug_lines;
188extern int do_debug_pubnames;
189extern int do_debug_pubtypes;
190extern int do_debug_aranges;
191extern int do_debug_ranges;
192extern int do_debug_frames;
193extern int do_debug_frames_interp;
194extern int do_debug_macinfo;
195extern int do_debug_str;
196extern int do_debug_loc;
197extern int do_gdb_index;
198extern int do_trace_info;
199extern int do_trace_abbrevs;
200extern int do_trace_aranges;
201extern int do_wide;
202
203extern void init_dwarf_regnames (unsigned int);
204extern void init_dwarf_regnames_i386 (void);
205extern void init_dwarf_regnames_x86_64 (void);
206
207extern int load_debug_section (enum dwarf_section_display_enum, void *);
208extern void free_debug_section (enum dwarf_section_display_enum);
209
210extern void free_debug_memory (void);
211
212extern void dwarf_select_sections_by_names (const char *);
213extern void dwarf_select_sections_by_letters (const char *);
214extern void dwarf_select_sections_all (void);
215
216void * cmalloc (size_t, size_t);
217void * xcmalloc (size_t, size_t);
218void * xcrealloc (void *, size_t, size_t);
219
220dwarf_vma read_leb128 (unsigned char *, unsigned int *, int);
This page took 0.022831 seconds and 4 git commands to generate.