1 /* Declarations and definitions of codes relating to the DWARF2 and 2 DWARF3 symbolic debugging information formats. 3 Copyright (C) 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 4 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 5 Free Software Foundation, Inc. 6 7 Written by Gary Funck (gary@intrepid.com) The Ada Joint Program 8 Office (AJPO), Florida State University and Silicon Graphics Inc. 9 provided support for this effort -- June 21, 1995. 10 11 Derived from the DWARF 1 implementation written by Ron Guilmette 12 (rfg@netcom.com), November 1990. 13 14 This file is part of GCC. 15 16 GCC is free software; you can redistribute it and/or modify it under 17 the terms of the GNU General Public License as published by the Free 18 Software Foundation; either version 3, or (at your option) any later 19 version. 20 21 GCC is distributed in the hope that it will be useful, but WITHOUT 22 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 23 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 24 License for more details. 25 26 Under Section 7 of GPL version 3, you are granted additional 27 permissions described in the GCC Runtime Library Exception, version 28 3.1, as published by the Free Software Foundation. 29 30 You should have received a copy of the GNU General Public License and 31 a copy of the GCC Runtime Library Exception along with this program; 32 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 33 <http://www.gnu.org/licenses/>. */ 34 35 /* This file is derived from the DWARF specification (a public document) 36 Revision 2.0.0 (July 27, 1993) developed by the UNIX International 37 Programming Languages Special Interest Group (UI/PLSIG) and distributed 38 by UNIX International. Copies of this specification are available from 39 UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054. 40 41 This file also now contains definitions from the DWARF 3 specification 42 published Dec 20, 2005, available from: http://dwarf.freestandards.org. */ 43 44 #ifndef _DWARF2_H 45 #define _DWARF2_H 46 47 #define DW_TAG(name, value) , name = value 48 #define DW_TAG_DUP(name, value) , name = value 49 #define DW_FORM(name, value) , name = value 50 #define DW_AT(name, value) , name = value 51 #define DW_AT_DUP(name, value) , name = value 52 #define DW_OP(name, value) , name = value 53 #define DW_OP_DUP(name, value) , name = value 54 #define DW_ATE(name, value) , name = value 55 #define DW_ATE_DUP(name, value) , name = value 56 #define DW_CFA(name, value) , name = value 57 58 #define DW_FIRST_TAG(name, value) enum dwarf_tag { \ 59 name = value 60 #define DW_END_TAG }; 61 #define DW_FIRST_FORM(name, value) enum dwarf_form { \ 62 name = value 63 #define DW_END_FORM }; 64 #define DW_FIRST_AT(name, value) enum dwarf_attribute { \ 65 name = value 66 #define DW_END_AT }; 67 #define DW_FIRST_OP(name, value) enum dwarf_location_atom { \ 68 name = value 69 #define DW_END_OP }; 70 #define DW_FIRST_ATE(name, value) enum dwarf_type { \ 71 name = value 72 #define DW_END_ATE }; 73 #define DW_FIRST_CFA(name, value) enum dwarf_call_frame_info { \ 74 name = value 75 #define DW_END_CFA }; 76 77 #include "dwarf2.def" 78 79 #undef DW_FIRST_TAG 80 #undef DW_END_TAG 81 #undef DW_FIRST_FORM 82 #undef DW_END_FORM 83 #undef DW_FIRST_AT 84 #undef DW_END_AT 85 #undef DW_FIRST_OP 86 #undef DW_END_OP 87 #undef DW_FIRST_ATE 88 #undef DW_END_ATE 89 #undef DW_FIRST_CFA 90 #undef DW_END_CFA 91 92 #undef DW_TAG 93 #undef DW_TAG_DUP 94 #undef DW_FORM 95 #undef DW_AT 96 #undef DW_AT_DUP 97 #undef DW_OP 98 #undef DW_OP_DUP 99 #undef DW_ATE 100 #undef DW_ATE_DUP 101 #undef DW_CFA 102 103 /* Flag that tells whether entry has a child or not. */ 104 #define DW_children_no 0 105 #define DW_children_yes 1 106 107 #define DW_AT_stride_size DW_AT_bit_stride /* Note: The use of DW_AT_stride_size is deprecated. */ 108 #define DW_AT_stride DW_AT_byte_stride /* Note: The use of DW_AT_stride is deprecated. */ 109 110 /* Decimal sign encodings. */ 111 enum dwarf_decimal_sign_encoding 112 { 113 /* DWARF 3. */ 114 DW_DS_unsigned = 0x01, 115 DW_DS_leading_overpunch = 0x02, 116 DW_DS_trailing_overpunch = 0x03, 117 DW_DS_leading_separate = 0x04, 118 DW_DS_trailing_separate = 0x05 119 }; 120 121 /* Endianity encodings. */ 122 enum dwarf_endianity_encoding 123 { 124 /* DWARF 3. */ 125 DW_END_default = 0x00, 126 DW_END_big = 0x01, 127 DW_END_little = 0x02, 128 129 DW_END_lo_user = 0x40, 130 DW_END_hi_user = 0xff 131 }; 132 133 /* Array ordering names and codes. */ 134 enum dwarf_array_dim_ordering 135 { 136 DW_ORD_row_major = 0, 137 DW_ORD_col_major = 1 138 }; 139 140 /* Access attribute. */ 141 enum dwarf_access_attribute 142 { 143 DW_ACCESS_public = 1, 144 DW_ACCESS_protected = 2, 145 DW_ACCESS_private = 3 146 }; 147 148 /* Visibility. */ 149 enum dwarf_visibility_attribute 150 { 151 DW_VIS_local = 1, 152 DW_VIS_exported = 2, 153 DW_VIS_qualified = 3 154 }; 155 156 /* Virtuality. */ 157 enum dwarf_virtuality_attribute 158 { 159 DW_VIRTUALITY_none = 0, 160 DW_VIRTUALITY_virtual = 1, 161 DW_VIRTUALITY_pure_virtual = 2 162 }; 163 164 /* Case sensitivity. */ 165 enum dwarf_id_case 166 { 167 DW_ID_case_sensitive = 0, 168 DW_ID_up_case = 1, 169 DW_ID_down_case = 2, 170 DW_ID_case_insensitive = 3 171 }; 172 173 /* Calling convention. */ 174 enum dwarf_calling_convention 175 { 176 DW_CC_normal = 0x1, 177 DW_CC_program = 0x2, 178 DW_CC_nocall = 0x3, 179 180 DW_CC_lo_user = 0x40, 181 DW_CC_hi_user = 0xff, 182 183 DW_CC_GNU_renesas_sh = 0x40, 184 DW_CC_GNU_borland_fastcall_i386 = 0x41, 185 186 /* This DW_CC_ value is not currently generated by any toolchain. It is 187 used internally to GDB to indicate OpenCL C functions that have been 188 compiled with the IBM XL C for OpenCL compiler and use a non-platform 189 calling convention for passing OpenCL C vector types. This value may 190 be changed freely as long as it does not conflict with any other DW_CC_ 191 value defined here. */ 192 DW_CC_GDB_IBM_OpenCL = 0xff 193 }; 194 195 /* Inline attribute. */ 196 enum dwarf_inline_attribute 197 { 198 DW_INL_not_inlined = 0, 199 DW_INL_inlined = 1, 200 DW_INL_declared_not_inlined = 2, 201 DW_INL_declared_inlined = 3 202 }; 203 204 /* Discriminant lists. */ 205 enum dwarf_discrim_list 206 { 207 DW_DSC_label = 0, 208 DW_DSC_range = 1 209 }; 210 211 /* Line number opcodes. */ 212 enum dwarf_line_number_ops 213 { 214 DW_LNS_extended_op = 0, 215 DW_LNS_copy = 1, 216 DW_LNS_advance_pc = 2, 217 DW_LNS_advance_line = 3, 218 DW_LNS_set_file = 4, 219 DW_LNS_set_column = 5, 220 DW_LNS_negate_stmt = 6, 221 DW_LNS_set_basic_block = 7, 222 DW_LNS_const_add_pc = 8, 223 DW_LNS_fixed_advance_pc = 9, 224 /* DWARF 3. */ 225 DW_LNS_set_prologue_end = 10, 226 DW_LNS_set_epilogue_begin = 11, 227 DW_LNS_set_isa = 12, 228 /* Experimental DWARF 5 extensions. 229 See http://wiki.dwarfstd.org/index.php?title=TwoLevelLineTables. */ 230 DW_LNS_set_address_from_logical = 13, /* Actuals table only. */ 231 DW_LNS_set_subprogram = 13, /* Logicals table only. */ 232 DW_LNS_inlined_call = 14, /* Logicals table only. */ 233 DW_LNS_pop_context = 15 /* Logicals table only. */ 234 }; 235 236 /* Line number extended opcodes. */ 237 enum dwarf_line_number_x_ops 238 { 239 DW_LNE_end_sequence = 1, 240 DW_LNE_set_address = 2, 241 DW_LNE_define_file = 3, 242 DW_LNE_set_discriminator = 4, 243 /* HP extensions. */ 244 DW_LNE_HP_negate_is_UV_update = 0x11, 245 DW_LNE_HP_push_context = 0x12, 246 DW_LNE_HP_pop_context = 0x13, 247 DW_LNE_HP_set_file_line_column = 0x14, 248 DW_LNE_HP_set_routine_name = 0x15, 249 DW_LNE_HP_set_sequence = 0x16, 250 DW_LNE_HP_negate_post_semantics = 0x17, 251 DW_LNE_HP_negate_function_exit = 0x18, 252 DW_LNE_HP_negate_front_end_logical = 0x19, 253 DW_LNE_HP_define_proc = 0x20, 254 DW_LNE_HP_source_file_correlation = 0x80, 255 256 DW_LNE_lo_user = 0x80, 257 DW_LNE_hi_user = 0xff 258 }; 259 260 /* Sub-opcodes for DW_LNE_HP_source_file_correlation. */ 261 enum dwarf_line_number_hp_sfc_ops 262 { 263 DW_LNE_HP_SFC_formfeed = 1, 264 DW_LNE_HP_SFC_set_listing_line = 2, 265 DW_LNE_HP_SFC_associate = 3 266 }; 267 268 /* Type codes for location list entries. 269 Extension for Fission. See http://gcc.gnu.org/wiki/DebugFission. */ 270 271 enum dwarf_location_list_entry_type 272 { 273 DW_LLE_GNU_end_of_list_entry = 0, 274 DW_LLE_GNU_base_address_selection_entry = 1, 275 DW_LLE_GNU_start_end_entry = 2, 276 DW_LLE_GNU_start_length_entry = 3 277 }; 278 279 /* Type codes for line number program content descriptors (DWARF 5). */ 280 281 enum dwarf_line_number_content_type 282 { 283 DW_LNCT_path = 1, 284 DW_LNCT_directory_index = 2, 285 DW_LNCT_timestamp = 3, 286 DW_LNCT_size = 4, 287 DW_LNCT_MD5 = 5, 288 /* Experimental DWARF 5 extensions. 289 See http://wiki.dwarfstd.org/index.php?title=TwoLevelLineTables. */ 290 DW_LNCT_subprogram_name = 6, 291 DW_LNCT_decl_file = 7, 292 DW_LNCT_decl_line = 8 293 }; 294 295 #define DW_CIE_ID 0xffffffff 296 #define DW64_CIE_ID 0xffffffffffffffffULL 297 #define DW_CIE_VERSION 1 298 299 #define DW_CFA_extended 0 300 301 #define DW_CHILDREN_no 0x00 302 #define DW_CHILDREN_yes 0x01 303 304 #define DW_ADDR_none 0 305 306 /* Source language names and codes. */ 307 enum dwarf_source_language 308 { 309 DW_LANG_C89 = 0x0001, 310 DW_LANG_C = 0x0002, 311 DW_LANG_Ada83 = 0x0003, 312 DW_LANG_C_plus_plus = 0x0004, 313 DW_LANG_Cobol74 = 0x0005, 314 DW_LANG_Cobol85 = 0x0006, 315 DW_LANG_Fortran77 = 0x0007, 316 DW_LANG_Fortran90 = 0x0008, 317 DW_LANG_Pascal83 = 0x0009, 318 DW_LANG_Modula2 = 0x000a, 319 /* DWARF 3. */ 320 DW_LANG_Java = 0x000b, 321 DW_LANG_C99 = 0x000c, 322 DW_LANG_Ada95 = 0x000d, 323 DW_LANG_Fortran95 = 0x000e, 324 DW_LANG_PLI = 0x000f, 325 DW_LANG_ObjC = 0x0010, 326 DW_LANG_ObjC_plus_plus = 0x0011, 327 DW_LANG_UPC = 0x0012, 328 DW_LANG_D = 0x0013, 329 /* DWARF 4. */ 330 DW_LANG_Python = 0x0014, 331 /* DWARF 5. */ 332 DW_LANG_Go = 0x0016, 333 334 DW_LANG_C_plus_plus_11 = 0x001a, /* dwarf5.20141029.pdf DRAFT */ 335 DW_LANG_C11 = 0x001d, 336 DW_LANG_C_plus_plus_14 = 0x0021, 337 DW_LANG_Fortran03 = 0x0022, 338 DW_LANG_Fortran08 = 0x0023, 339 340 DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */ 341 DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */ 342 343 /* MIPS. */ 344 DW_LANG_Mips_Assembler = 0x8001, 345 /* UPC. */ 346 DW_LANG_Upc = 0x8765, 347 /* HP extensions. */ 348 DW_LANG_HP_Bliss = 0x8003, 349 DW_LANG_HP_Basic91 = 0x8004, 350 DW_LANG_HP_Pascal91 = 0x8005, 351 DW_LANG_HP_IMacro = 0x8006, 352 DW_LANG_HP_Assembler = 0x8007 353 }; 354 355 /* Names and codes for macro information. */ 356 enum dwarf_macinfo_record_type 357 { 358 DW_MACINFO_define = 1, 359 DW_MACINFO_undef = 2, 360 DW_MACINFO_start_file = 3, 361 DW_MACINFO_end_file = 4, 362 DW_MACINFO_vendor_ext = 255 363 }; 364 365 /* Names and codes for new style macro information. */ 366 enum dwarf_macro_record_type 367 { 368 DW_MACRO_GNU_define = 1, 369 DW_MACRO_GNU_undef = 2, 370 DW_MACRO_GNU_start_file = 3, 371 DW_MACRO_GNU_end_file = 4, 372 DW_MACRO_GNU_define_indirect = 5, 373 DW_MACRO_GNU_undef_indirect = 6, 374 DW_MACRO_GNU_transparent_include = 7, 375 /* Extensions for DWZ multifile. 376 See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open . */ 377 DW_MACRO_GNU_define_indirect_alt = 8, 378 DW_MACRO_GNU_undef_indirect_alt = 9, 379 DW_MACRO_GNU_transparent_include_alt = 10, 380 DW_MACRO_GNU_lo_user = 0xe0, 381 DW_MACRO_GNU_hi_user = 0xff 382 }; 383 384 /* @@@ For use with GNU frame unwind information. */ 385 386 #define DW_EH_PE_absptr 0x00 387 #define DW_EH_PE_omit 0xff 388 389 #define DW_EH_PE_uleb128 0x01 390 #define DW_EH_PE_udata2 0x02 391 #define DW_EH_PE_udata4 0x03 392 #define DW_EH_PE_udata8 0x04 393 #define DW_EH_PE_sleb128 0x09 394 #define DW_EH_PE_sdata2 0x0A 395 #define DW_EH_PE_sdata4 0x0B 396 #define DW_EH_PE_sdata8 0x0C 397 #define DW_EH_PE_signed 0x08 398 399 #define DW_EH_PE_pcrel 0x10 400 #define DW_EH_PE_textrel 0x20 401 #define DW_EH_PE_datarel 0x30 402 #define DW_EH_PE_funcrel 0x40 403 #define DW_EH_PE_aligned 0x50 404 405 #define DW_EH_PE_indirect 0x80 406 407 /* Codes for the debug sections in a dwarf package (.dwp) file. 408 Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFissionDWP. */ 409 enum dwarf_sect 410 { 411 DW_SECT_INFO = 1, 412 DW_SECT_TYPES = 2, 413 DW_SECT_ABBREV = 3, 414 DW_SECT_LINE = 4, 415 DW_SECT_LOC = 5, 416 DW_SECT_STR_OFFSETS = 6, 417 DW_SECT_MACINFO = 7, 418 DW_SECT_MACRO = 8, 419 DW_SECT_MAX = 8 420 }; 421 422 #ifdef __cplusplus 423 extern "C" { 424 #endif /* __cplusplus */ 425 426 /* Return the name of a DW_TAG_ constant, or NULL if the value is not 427 recognized. */ 428 extern const char *get_DW_TAG_name (unsigned int tag); 429 430 /* Return the name of a DW_AT_ constant, or NULL if the value is not 431 recognized. */ 432 extern const char *get_DW_AT_name (unsigned int attr); 433 434 /* Return the name of a DW_FORM_ constant, or NULL if the value is not 435 recognized. */ 436 extern const char *get_DW_FORM_name (unsigned int form); 437 438 /* Return the name of a DW_OP_ constant, or NULL if the value is not 439 recognized. */ 440 extern const char *get_DW_OP_name (unsigned int op); 441 442 /* Return the name of a DW_ATE_ constant, or NULL if the value is not 443 recognized. */ 444 extern const char *get_DW_ATE_name (unsigned int enc); 445 446 /* Return the name of a DW_CFA_ constant, or NULL if the value is not 447 recognized. */ 448 extern const char *get_DW_CFA_name (unsigned int opc); 449 450 #ifdef __cplusplus 451 } 452 #endif /* __cplusplus */ 453 454 #endif /* _DWARF2_H */ 455