x86: Restore PC16 relocation overflow check
[deliverable/binutils-gdb.git] / include / dwarf2.h
CommitLineData
e0452928
DD
1/* Declarations and definitions of codes relating to the DWARF2 and
2 DWARF3 symbolic debugging information formats.
250d07de 3 Copyright (C) 1992-2021 Free Software Foundation, Inc.
e0452928
DD
4
5 Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
6 Office (AJPO), Florida State University and Silicon Graphics Inc.
7 provided support for this effort -- June 21, 1995.
8
9 Derived from the DWARF 1 implementation written by Ron Guilmette
10 (rfg@netcom.com), November 1990.
11
12 This file is part of GCC.
13
14 GCC is free software; you can redistribute it and/or modify it under
15 the terms of the GNU General Public License as published by the Free
16 Software Foundation; either version 3, or (at your option) any later
17 version.
18
19 GCC is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 License for more details.
23
24 Under Section 7 of GPL version 3, you are granted additional
25 permissions described in the GCC Runtime Library Exception, version
26 3.1, as published by the Free Software Foundation.
27
28 You should have received a copy of the GNU General Public License and
29 a copy of the GCC Runtime Library Exception along with this program;
30 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
31 <http://www.gnu.org/licenses/>. */
32
33/* This file is derived from the DWARF specification (a public document)
34 Revision 2.0.0 (July 27, 1993) developed by the UNIX International
35 Programming Languages Special Interest Group (UI/PLSIG) and distributed
36 by UNIX International. Copies of this specification are available from
37 UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
38
39 This file also now contains definitions from the DWARF 3 specification
40 published Dec 20, 2005, available from: http://dwarf.freestandards.org. */
41
47704ddf
KT
42#ifndef _DWARF2_H
43#define _DWARF2_H
e0452928 44
fa66ec53
DD
45#define DW_TAG(name, value) , name = value
46#define DW_TAG_DUP(name, value) , name = value
47#define DW_FORM(name, value) , name = value
48#define DW_AT(name, value) , name = value
49#define DW_AT_DUP(name, value) , name = value
50#define DW_OP(name, value) , name = value
51#define DW_OP_DUP(name, value) , name = value
52#define DW_ATE(name, value) , name = value
53#define DW_ATE_DUP(name, value) , name = value
54#define DW_CFA(name, value) , name = value
26a67918 55#define DW_CFA_DUP(name, value) , name = value
de837d77
JK
56#define DW_IDX(name, value) , name = value
57#define DW_IDX_DUP(name, value) , name = value
d7b477c5 58#define DW_UT(name, value) , name = value
fa66ec53
DD
59
60#define DW_FIRST_TAG(name, value) enum dwarf_tag { \
61 name = value
62#define DW_END_TAG };
63#define DW_FIRST_FORM(name, value) enum dwarf_form { \
64 name = value
65#define DW_END_FORM };
66#define DW_FIRST_AT(name, value) enum dwarf_attribute { \
67 name = value
68#define DW_END_AT };
69#define DW_FIRST_OP(name, value) enum dwarf_location_atom { \
70 name = value
71#define DW_END_OP };
72#define DW_FIRST_ATE(name, value) enum dwarf_type { \
73 name = value
74#define DW_END_ATE };
75#define DW_FIRST_CFA(name, value) enum dwarf_call_frame_info { \
76 name = value
77#define DW_END_CFA };
de837d77
JK
78#define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
79 name = value
80#define DW_END_IDX };
d7b477c5
MW
81#define DW_FIRST_UT(name, value) enum dwarf_unit_type { \
82 name = value
83#define DW_END_UT };
fa66ec53
DD
84
85#include "dwarf2.def"
86
87#undef DW_FIRST_TAG
88#undef DW_END_TAG
89#undef DW_FIRST_FORM
90#undef DW_END_FORM
91#undef DW_FIRST_AT
92#undef DW_END_AT
93#undef DW_FIRST_OP
94#undef DW_END_OP
95#undef DW_FIRST_ATE
96#undef DW_END_ATE
97#undef DW_FIRST_CFA
98#undef DW_END_CFA
de837d77
JK
99#undef DW_FIRST_IDX
100#undef DW_END_IDX
d7b477c5
MW
101#undef DW_FIRST_UT
102#undef DW_END_UT
fa66ec53
DD
103
104#undef DW_TAG
105#undef DW_TAG_DUP
106#undef DW_FORM
107#undef DW_AT
108#undef DW_AT_DUP
109#undef DW_OP
110#undef DW_OP_DUP
111#undef DW_ATE
112#undef DW_ATE_DUP
113#undef DW_CFA
26a67918 114#undef DW_CFA_DUP
de837d77
JK
115#undef DW_IDX
116#undef DW_IDX_DUP
d7b477c5 117#undef DW_UT
e0452928
DD
118
119/* Flag that tells whether entry has a child or not. */
120#define DW_children_no 0
121#define DW_children_yes 1
122
e0452928 123#define DW_AT_stride_size DW_AT_bit_stride /* Note: The use of DW_AT_stride_size is deprecated. */
e0452928 124#define DW_AT_stride DW_AT_byte_stride /* Note: The use of DW_AT_stride is deprecated. */
e0452928
DD
125
126/* Decimal sign encodings. */
127enum dwarf_decimal_sign_encoding
128 {
129 /* DWARF 3. */
130 DW_DS_unsigned = 0x01,
131 DW_DS_leading_overpunch = 0x02,
132 DW_DS_trailing_overpunch = 0x03,
133 DW_DS_leading_separate = 0x04,
134 DW_DS_trailing_separate = 0x05
135 };
136
137/* Endianity encodings. */
138enum dwarf_endianity_encoding
139 {
140 /* DWARF 3. */
141 DW_END_default = 0x00,
142 DW_END_big = 0x01,
143 DW_END_little = 0x02,
144
145 DW_END_lo_user = 0x40,
146 DW_END_hi_user = 0xff
147 };
148
149/* Array ordering names and codes. */
150enum dwarf_array_dim_ordering
151 {
152 DW_ORD_row_major = 0,
153 DW_ORD_col_major = 1
154 };
155
156/* Access attribute. */
157enum dwarf_access_attribute
158 {
159 DW_ACCESS_public = 1,
160 DW_ACCESS_protected = 2,
161 DW_ACCESS_private = 3
162 };
163
164/* Visibility. */
165enum dwarf_visibility_attribute
166 {
167 DW_VIS_local = 1,
168 DW_VIS_exported = 2,
169 DW_VIS_qualified = 3
170 };
171
172/* Virtuality. */
173enum dwarf_virtuality_attribute
174 {
175 DW_VIRTUALITY_none = 0,
176 DW_VIRTUALITY_virtual = 1,
177 DW_VIRTUALITY_pure_virtual = 2
178 };
179
180/* Case sensitivity. */
181enum dwarf_id_case
182 {
183 DW_ID_case_sensitive = 0,
184 DW_ID_up_case = 1,
185 DW_ID_down_case = 2,
186 DW_ID_case_insensitive = 3
187 };
188
189/* Calling convention. */
190enum dwarf_calling_convention
191 {
192 DW_CC_normal = 0x1,
193 DW_CC_program = 0x2,
194 DW_CC_nocall = 0x3,
195
fb9b4b7e
NC
196 /* DWARF 5. */
197 DW_CC_pass_by_reference = 0x4,
198 DW_CC_pass_by_value = 0x5,
199
e0452928
DD
200 DW_CC_lo_user = 0x40,
201 DW_CC_hi_user = 0xff,
202
dec397b2 203 DW_CC_GNU_renesas_sh = 0x40,
54fcddd0
UW
204 DW_CC_GNU_borland_fastcall_i386 = 0x41,
205
206 /* This DW_CC_ value is not currently generated by any toolchain. It is
207 used internally to GDB to indicate OpenCL C functions that have been
208 compiled with the IBM XL C for OpenCL compiler and use a non-platform
209 calling convention for passing OpenCL C vector types. This value may
210 be changed freely as long as it does not conflict with any other DW_CC_
211 value defined here. */
212 DW_CC_GDB_IBM_OpenCL = 0xff
e0452928
DD
213 };
214
215/* Inline attribute. */
216enum dwarf_inline_attribute
217 {
218 DW_INL_not_inlined = 0,
219 DW_INL_inlined = 1,
220 DW_INL_declared_not_inlined = 2,
221 DW_INL_declared_inlined = 3
222 };
223
224/* Discriminant lists. */
225enum dwarf_discrim_list
226 {
227 DW_DSC_label = 0,
228 DW_DSC_range = 1
229 };
230
231/* Line number opcodes. */
232enum dwarf_line_number_ops
233 {
234 DW_LNS_extended_op = 0,
235 DW_LNS_copy = 1,
236 DW_LNS_advance_pc = 2,
237 DW_LNS_advance_line = 3,
238 DW_LNS_set_file = 4,
239 DW_LNS_set_column = 5,
240 DW_LNS_negate_stmt = 6,
241 DW_LNS_set_basic_block = 7,
242 DW_LNS_const_add_pc = 8,
243 DW_LNS_fixed_advance_pc = 9,
244 /* DWARF 3. */
245 DW_LNS_set_prologue_end = 10,
246 DW_LNS_set_epilogue_begin = 11,
247 DW_LNS_set_isa = 12
248 };
249
250/* Line number extended opcodes. */
251enum dwarf_line_number_x_ops
252 {
253 DW_LNE_end_sequence = 1,
254 DW_LNE_set_address = 2,
255 DW_LNE_define_file = 3,
256 DW_LNE_set_discriminator = 4,
257 /* HP extensions. */
258 DW_LNE_HP_negate_is_UV_update = 0x11,
259 DW_LNE_HP_push_context = 0x12,
260 DW_LNE_HP_pop_context = 0x13,
261 DW_LNE_HP_set_file_line_column = 0x14,
262 DW_LNE_HP_set_routine_name = 0x15,
263 DW_LNE_HP_set_sequence = 0x16,
264 DW_LNE_HP_negate_post_semantics = 0x17,
265 DW_LNE_HP_negate_function_exit = 0x18,
266 DW_LNE_HP_negate_front_end_logical = 0x19,
267 DW_LNE_HP_define_proc = 0x20,
93a6c7a4 268 DW_LNE_HP_source_file_correlation = 0x80,
e0452928
DD
269
270 DW_LNE_lo_user = 0x80,
271 DW_LNE_hi_user = 0xff
272 };
273
bbda3415
TG
274/* Sub-opcodes for DW_LNE_HP_source_file_correlation. */
275enum dwarf_line_number_hp_sfc_ops
276 {
277 DW_LNE_HP_SFC_formfeed = 1,
278 DW_LNE_HP_SFC_set_listing_line = 2,
279 DW_LNE_HP_SFC_associate = 3
280 };
281
fb9b4b7e
NC
282/* Content type codes in line table directory_entry_format
283 and file_name_entry_format sequences. */
284enum dwarf_line_number_content_type
285 {
286 DW_LNCT_path = 0x1,
287 DW_LNCT_directory_index = 0x2,
288 DW_LNCT_timestamp = 0x3,
289 DW_LNCT_size = 0x4,
290 DW_LNCT_MD5 = 0x5,
291 DW_LNCT_lo_user = 0x2000,
292 DW_LNCT_hi_user = 0x3fff
293 };
1f3de044 294
fb9b4b7e 295/* Type codes for location list entries. */
1f3de044
DD
296enum dwarf_location_list_entry_type
297 {
fb9b4b7e
NC
298 DW_LLE_end_of_list = 0x00,
299 DW_LLE_base_addressx = 0x01,
300 DW_LLE_startx_endx = 0x02,
301 DW_LLE_startx_length = 0x03,
302 DW_LLE_offset_pair = 0x04,
303 DW_LLE_default_location = 0x05,
304 DW_LLE_base_address = 0x06,
305 DW_LLE_start_end = 0x07,
306 DW_LLE_start_length = 0x08,
307
9f272209
AO
308 /* <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/2017-April/004347.html>
309 has the proposal for now; only available to list members.
310
311 A (possibly updated) copy of the proposal is available at
312 <http://people.redhat.com/aoliva/papers/sfn/dwarf6-sfn-lvu.txt>. */
313 DW_LLE_GNU_view_pair = 0x09,
314#define DW_LLE_view_pair DW_LLE_GNU_view_pair
315
fb9b4b7e
NC
316 /* Former extension for Fission.
317 See http://gcc.gnu.org/wiki/DebugFission. */
318 DW_LLE_GNU_end_of_list_entry = 0x00,
319 DW_LLE_GNU_base_address_selection_entry = 0x01,
320 DW_LLE_GNU_start_end_entry = 0x02,
321 DW_LLE_GNU_start_length_entry = 0x03
1f3de044
DD
322 };
323
e0452928
DD
324#define DW_CIE_ID 0xffffffff
325#define DW64_CIE_ID 0xffffffffffffffffULL
e0452928
DD
326
327#define DW_CFA_extended 0
328
329#define DW_CHILDREN_no 0x00
330#define DW_CHILDREN_yes 0x01
331
332#define DW_ADDR_none 0
333
334/* Source language names and codes. */
335enum dwarf_source_language
336 {
337 DW_LANG_C89 = 0x0001,
338 DW_LANG_C = 0x0002,
339 DW_LANG_Ada83 = 0x0003,
340 DW_LANG_C_plus_plus = 0x0004,
341 DW_LANG_Cobol74 = 0x0005,
342 DW_LANG_Cobol85 = 0x0006,
343 DW_LANG_Fortran77 = 0x0007,
344 DW_LANG_Fortran90 = 0x0008,
345 DW_LANG_Pascal83 = 0x0009,
346 DW_LANG_Modula2 = 0x000a,
347 /* DWARF 3. */
348 DW_LANG_Java = 0x000b,
349 DW_LANG_C99 = 0x000c,
350 DW_LANG_Ada95 = 0x000d,
351 DW_LANG_Fortran95 = 0x000e,
352 DW_LANG_PLI = 0x000f,
353 DW_LANG_ObjC = 0x0010,
354 DW_LANG_ObjC_plus_plus = 0x0011,
355 DW_LANG_UPC = 0x0012,
356 DW_LANG_D = 0x0013,
3fce87a0 357 /* DWARF 4. */
2b6f5997 358 DW_LANG_Python = 0x0014,
8baf536a 359 /* DWARF 5. */
fb9b4b7e 360 DW_LANG_OpenCL = 0x0015,
8baf536a 361 DW_LANG_Go = 0x0016,
fb9b4b7e
NC
362 DW_LANG_Modula3 = 0x0017,
363 DW_LANG_Haskell = 0x0018,
364 DW_LANG_C_plus_plus_03 = 0x0019,
365 DW_LANG_C_plus_plus_11 = 0x001a,
366 DW_LANG_OCaml = 0x001b,
5ff087ac 367 DW_LANG_Rust = 0x001c,
0cfd832f 368 DW_LANG_C11 = 0x001d,
fb9b4b7e
NC
369 DW_LANG_Swift = 0x001e,
370 DW_LANG_Julia = 0x001f,
371 DW_LANG_Dylan = 0x0020,
0cfd832f 372 DW_LANG_C_plus_plus_14 = 0x0021,
5a195044
MW
373 DW_LANG_Fortran03 = 0x0022,
374 DW_LANG_Fortran08 = 0x0023,
fb9b4b7e 375 DW_LANG_RenderScript = 0x0024,
0cfd832f 376
e0452928
DD
377 DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */
378 DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */
379
380 /* MIPS. */
381 DW_LANG_Mips_Assembler = 0x8001,
382 /* UPC. */
93a6c7a4
TG
383 DW_LANG_Upc = 0x8765,
384 /* HP extensions. */
385 DW_LANG_HP_Bliss = 0x8003,
386 DW_LANG_HP_Basic91 = 0x8004,
387 DW_LANG_HP_Pascal91 = 0x8005,
388 DW_LANG_HP_IMacro = 0x8006,
5ff087ac
TT
389 DW_LANG_HP_Assembler = 0x8007,
390
391 /* Rust extension, but replaced in DWARF 5. */
392 DW_LANG_Rust_old = 0x9000
e0452928
DD
393 };
394
395/* Names and codes for macro information. */
396enum dwarf_macinfo_record_type
397 {
398 DW_MACINFO_define = 1,
399 DW_MACINFO_undef = 2,
400 DW_MACINFO_start_file = 3,
401 DW_MACINFO_end_file = 4,
402 DW_MACINFO_vendor_ext = 255
403 };
d4743114 404
fb9b4b7e
NC
405/* DW_TAG_defaulted/DW_TAG_GNU_defaulted attributes. */
406enum dwarf_defaulted_attribute
407 {
408 DW_DEFAULTED_no = 0x00,
409 DW_DEFAULTED_in_class = 0x01,
410 DW_DEFAULTED_out_of_class = 0x02
411 };
412
d4743114
JJ
413/* Names and codes for new style macro information. */
414enum dwarf_macro_record_type
415 {
fb9b4b7e
NC
416 DW_MACRO_define = 0x01,
417 DW_MACRO_undef = 0x02,
418 DW_MACRO_start_file = 0x03,
419 DW_MACRO_end_file = 0x04,
420 DW_MACRO_define_strp = 0x05,
421 DW_MACRO_undef_strp = 0x06,
422 DW_MACRO_import = 0x07,
423 DW_MACRO_define_sup = 0x08,
424 DW_MACRO_undef_sup = 0x09,
425 DW_MACRO_import_sup = 0x0a,
426 DW_MACRO_define_strx = 0x0b,
427 DW_MACRO_undef_strx = 0x0c,
428 DW_MACRO_lo_user = 0xe0,
429 DW_MACRO_hi_user = 0xff,
430
431 /* Compatibility macros for the GNU .debug_macro extension. */
432 DW_MACRO_GNU_define = 0x01,
433 DW_MACRO_GNU_undef = 0x02,
434 DW_MACRO_GNU_start_file = 0x03,
435 DW_MACRO_GNU_end_file = 0x04,
436 DW_MACRO_GNU_define_indirect = 0x05,
437 DW_MACRO_GNU_undef_indirect = 0x06,
438 DW_MACRO_GNU_transparent_include = 0x07,
9761def5
DD
439 /* Extensions for DWZ multifile.
440 See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open . */
fb9b4b7e
NC
441 DW_MACRO_GNU_define_indirect_alt = 0x08,
442 DW_MACRO_GNU_undef_indirect_alt = 0x09,
443 DW_MACRO_GNU_transparent_include_alt = 0x0a,
d4743114
JJ
444 DW_MACRO_GNU_lo_user = 0xe0,
445 DW_MACRO_GNU_hi_user = 0xff
446 };
fb9b4b7e 447
fb9b4b7e
NC
448/* Range list entry kinds in .debug_rnglists* section. */
449enum dwarf_range_list_entry
450 {
451 DW_RLE_end_of_list = 0x00,
452 DW_RLE_base_addressx = 0x01,
453 DW_RLE_startx_endx = 0x02,
454 DW_RLE_startx_length = 0x03,
455 DW_RLE_offset_pair = 0x04,
456 DW_RLE_base_address = 0x05,
457 DW_RLE_start_end = 0x06,
458 DW_RLE_start_length = 0x07
459 };
e0452928
DD
460\f
461/* @@@ For use with GNU frame unwind information. */
462
463#define DW_EH_PE_absptr 0x00
464#define DW_EH_PE_omit 0xff
465
466#define DW_EH_PE_uleb128 0x01
467#define DW_EH_PE_udata2 0x02
468#define DW_EH_PE_udata4 0x03
469#define DW_EH_PE_udata8 0x04
470#define DW_EH_PE_sleb128 0x09
471#define DW_EH_PE_sdata2 0x0A
472#define DW_EH_PE_sdata4 0x0B
473#define DW_EH_PE_sdata8 0x0C
474#define DW_EH_PE_signed 0x08
475
476#define DW_EH_PE_pcrel 0x10
477#define DW_EH_PE_textrel 0x20
478#define DW_EH_PE_datarel 0x30
479#define DW_EH_PE_funcrel 0x40
480#define DW_EH_PE_aligned 0x50
481
482#define DW_EH_PE_indirect 0x80
483
374694f0 484/* Codes for the debug sections in a dwarf package (.dwp) file.
a69ee13f
CT
485 (From the pre-standard formats Extensions for Fission.
486 See http://gcc.gnu.org/wiki/DebugFissionDWP). */
374694f0 487enum dwarf_sect
a69ee13f
CT
488{
489 DW_SECT_INFO = 1,
490 DW_SECT_TYPES = 2,
491 DW_SECT_ABBREV = 3,
492 DW_SECT_LINE = 4,
493 DW_SECT_LOC = 5,
494 DW_SECT_STR_OFFSETS = 6,
495 DW_SECT_MACINFO = 7,
496 DW_SECT_MACRO = 8,
497 DW_SECT_MAX = 8
498};
499
500/* Codes for the debug sections in a dwarf package (.dwp) file.
501 (From the official DWARF v5 spec.
502 See http://dwarfstd.org/doc/DWARF5.pdf, section 7.3.5). */
503enum dwarf_sect_v5
504{
505 DW_SECT_INFO_V5 = 1,
506 DW_SECT_RESERVED_V5 = 2,
507 DW_SECT_ABBREV_V5 = 3,
508 DW_SECT_LINE_V5 = 4,
509 DW_SECT_LOCLISTS_V5 = 5,
510 DW_SECT_STR_OFFSETS_V5 = 6,
511 DW_SECT_MACRO_V5 = 7,
512 DW_SECT_RNGLISTS_V5 = 8,
513 DW_SECT_MAX_V5 = 8
514};
fa66ec53
DD
515
516#ifdef __cplusplus
517extern "C" {
518#endif /* __cplusplus */
519
520/* Return the name of a DW_TAG_ constant, or NULL if the value is not
521 recognized. */
522extern const char *get_DW_TAG_name (unsigned int tag);
523
524/* Return the name of a DW_AT_ constant, or NULL if the value is not
525 recognized. */
526extern const char *get_DW_AT_name (unsigned int attr);
527
528/* Return the name of a DW_FORM_ constant, or NULL if the value is not
529 recognized. */
530extern const char *get_DW_FORM_name (unsigned int form);
531
532/* Return the name of a DW_OP_ constant, or NULL if the value is not
533 recognized. */
534extern const char *get_DW_OP_name (unsigned int op);
535
536/* Return the name of a DW_ATE_ constant, or NULL if the value is not
537 recognized. */
538extern const char *get_DW_ATE_name (unsigned int enc);
539
540/* Return the name of a DW_CFA_ constant, or NULL if the value is not
541 recognized. */
542extern const char *get_DW_CFA_name (unsigned int opc);
543
de837d77
JK
544/* Return the name of a DW_IDX_ constant, or NULL if the value is not
545 recognized. */
546extern const char *get_DW_IDX_name (unsigned int idx);
547
d7b477c5
MW
548/* Return the name of a DW_UT_ constant, or NULL if the value is not
549 recognized. */
550extern const char *get_DW_UT_name (unsigned int ut);
551
fa66ec53
DD
552#ifdef __cplusplus
553}
554#endif /* __cplusplus */
555
47704ddf 556#endif /* _DWARF2_H */
This page took 0.625584 seconds and 4 git commands to generate.