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