]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - binutils/dwarf.h
opcodes/arc: Fix extract for some add_s instructions
[thirdparty/binutils-gdb.git] / binutils / dwarf.h
CommitLineData
1b315056 1/* dwarf.h - DWARF support header file
6f2750fe 2 Copyright (C) 2005-2016 Free Software Foundation, Inc.
19e6b90e 3
32866df7 4 This file is part of GNU Binutils.
19e6b90e 5
32866df7
NC
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.
19e6b90e 10
32866df7
NC
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.
19e6b90e 15
32866df7
NC
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. */
19e6b90e 20
467c65bc
NC
21typedef unsigned HOST_WIDEST_INT dwarf_vma;
22typedef HOST_WIDEST_INT dwarf_signed_vma;
23typedef unsigned HOST_WIDEST_INT dwarf_size_type;
19e6b90e 24
47704ddf 25/* Structure found in the .debug_line section. */
47704ddf
KT
26typedef struct
27{
467c65bc 28 dwarf_vma li_length;
47704ddf 29 unsigned short li_version;
77ef8654 30 dwarf_vma li_prologue_length;
47704ddf
KT
31 unsigned char li_min_insn_length;
32 unsigned char li_max_ops_per_insn;
33 unsigned char li_default_is_stmt;
34 int li_line_base;
35 unsigned char li_line_range;
36 unsigned char li_opcode_base;
37}
38DWARF2_Internal_LineInfo;
39
40/* Structure found in .debug_pubnames section. */
47704ddf
KT
41typedef struct
42{
467c65bc 43 dwarf_vma pn_length;
47704ddf 44 unsigned short pn_version;
467c65bc
NC
45 dwarf_vma pn_offset;
46 dwarf_vma pn_size;
47704ddf
KT
47}
48DWARF2_Internal_PubNames;
49
50/* Structure found in .debug_info section. */
47704ddf
KT
51typedef struct
52{
467c65bc 53 dwarf_vma cu_length;
47704ddf 54 unsigned short cu_version;
467c65bc 55 dwarf_vma cu_abbrev_offset;
47704ddf
KT
56 unsigned char cu_pointer_size;
57}
58DWARF2_Internal_CompUnit;
59
77ef8654 60/* Structure found in .debug_aranges section. */
47704ddf
KT
61typedef struct
62{
467c65bc 63 dwarf_vma ar_length;
47704ddf 64 unsigned short ar_version;
467c65bc 65 dwarf_vma ar_info_offset;
47704ddf
KT
66 unsigned char ar_pointer_size;
67 unsigned char ar_segment_size;
68}
69DWARF2_Internal_ARange;
70
459d52c8
DE
71/* N.B. The order here must match the order in debug_displays. */
72
c34f4fc6
NC
73enum dwarf_section_display_enum
74{
19e6b90e
L
75 abbrev = 0,
76 aranges,
77 frame,
78 info,
79 line,
80 pubnames,
459d52c8 81 gnu_pubnames,
19e6b90e
L
82 eh_frame,
83 macinfo,
4ccf1e31 84 macro,
19e6b90e
L
85 str,
86 loc,
87 pubtypes,
459d52c8 88 gnu_pubtypes,
19e6b90e
L
89 ranges,
90 static_func,
91 static_vars,
92 types,
93 weaknames,
48049d1e 94 gdb_index,
6f875884
TG
95 trace_info,
96 trace_abbrev,
97 trace_aranges,
4723351a
CC
98 info_dwo,
99 abbrev_dwo,
100 types_dwo,
101 line_dwo,
102 loc_dwo,
103 macro_dwo,
104 macinfo_dwo,
105 str_dwo,
106 str_index,
107 str_index_dwo,
108 debug_addr,
657d0d47
CC
109 dwp_cu_index,
110 dwp_tu_index,
19e6b90e
L
111 max
112};
113
4723351a
CC
114struct dwarf_section
115{
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;
122 const char *name;
123 unsigned char *start;
124 dwarf_vma address;
125 dwarf_size_type size;
126 enum dwarf_section_display_enum abbrev_sec;
d1c4b12b
NC
127
128 /* Used by clients to help them implement the reloc_at callback. */
129 void * reloc_info;
130 unsigned long num_relocs;
131
06614111
NC
132 /* A spare field for random use. */
133 void *user_data;
4723351a
CC
134};
135
136/* A structure containing the name of a debug section
137 and a pointer to a function that can decode it. */
138struct dwarf_section_display
139{
140 struct dwarf_section section;
141 int (*display) (struct dwarf_section *, void *);
142 int *enabled;
d1c4b12b 143 bfd_boolean relocate;
4723351a
CC
144};
145
19e6b90e
L
146extern struct dwarf_section_display debug_displays [];
147
148/* This structure records the information that
149 we extract from the.debug_info section. */
150typedef struct
151{
152 unsigned int pointer_size;
b7807392
JJ
153 unsigned int offset_size;
154 int dwarf_version;
467c65bc
NC
155 dwarf_vma cu_offset;
156 dwarf_vma base_address;
4723351a
CC
157 /* This field is filled in when reading the attribute DW_AT_GNU_addr_base and
158 is used with the form DW_AT_GNU_FORM_addr_index. */
159 dwarf_vma addr_base;
160 /* This field is filled in when reading the attribute DW_AT_GNU_ranges_base and
161 is used when calculating ranges. */
162 dwarf_vma ranges_base;
19e6b90e 163 /* This is an array of offsets to the location list table. */
467c65bc
NC
164 dwarf_vma * loc_offsets;
165 int * have_frame_base;
19e6b90e
L
166 unsigned int num_loc_offsets;
167 unsigned int max_loc_offsets;
01a8f077 168 /* List of .debug_ranges offsets seen in this .debug_info. */
467c65bc 169 dwarf_vma * range_lists;
19e6b90e
L
170 unsigned int num_range_lists;
171 unsigned int max_range_lists;
172}
173debug_info;
174
77ef8654 175extern unsigned int eh_addr_size;
19e6b90e
L
176
177extern int do_debug_info;
178extern int do_debug_abbrevs;
179extern int do_debug_lines;
180extern int do_debug_pubnames;
f9f0e732 181extern int do_debug_pubtypes;
19e6b90e
L
182extern int do_debug_aranges;
183extern int do_debug_ranges;
184extern int do_debug_frames;
185extern int do_debug_frames_interp;
186extern int do_debug_macinfo;
187extern int do_debug_str;
188extern int do_debug_loc;
5bbdf3d5 189extern int do_gdb_index;
6f875884
TG
190extern int do_trace_info;
191extern int do_trace_abbrevs;
192extern int do_trace_aranges;
657d0d47
CC
193extern int do_debug_addr;
194extern int do_debug_cu_index;
c34f4fc6 195extern int do_wide;
19e6b90e 196
fd2f0033
TT
197extern int dwarf_cutoff_level;
198extern unsigned long dwarf_start_die;
199
4723351a
CC
200extern int dwarf_check;
201
2dc4cec1 202extern void init_dwarf_regnames (unsigned int);
b129eb0e 203extern void init_dwarf_regnames_i386 (void);
3d875af5 204extern void init_dwarf_regnames_iamcu (void);
b129eb0e 205extern void init_dwarf_regnames_x86_64 (void);
4ee22035 206extern void init_dwarf_regnames_aarch64 (void);
d6bb17b0 207extern void init_dwarf_regnames_s390 (void);
2dc4cec1 208
467c65bc 209extern int load_debug_section (enum dwarf_section_display_enum, void *);
19e6b90e
L
210extern void free_debug_section (enum dwarf_section_display_enum);
211
212extern void free_debug_memory (void);
213
c34f4fc6
NC
214extern void dwarf_select_sections_by_names (const char *);
215extern void dwarf_select_sections_by_letters (const char *);
4cb93e3b
TG
216extern void dwarf_select_sections_all (void);
217
82b1b41b 218extern unsigned int * find_cu_tu_set (void *, unsigned int);
657d0d47 219
82b1b41b 220extern void * cmalloc (size_t, size_t);
72c61a0d 221extern void * xcalloc2 (size_t, size_t);
82b1b41b
NC
222extern void * xcmalloc (size_t, size_t);
223extern void * xcrealloc (void *, size_t, size_t);
19e6b90e 224
f6f0e17b 225extern dwarf_vma read_leb128 (unsigned char *, unsigned int *, bfd_boolean, const unsigned char * const);
d1c4b12b
NC
226
227/* A callback into the client. Retuns TRUE if there is a
228 relocation against the given debug section at the given
229 offset. */
230extern bfd_boolean reloc_at (struct dwarf_section *, dwarf_vma);