1 // dwarf.h -- DWARF2 constants -*- C++ -*- 2 3 // Copyright (C) 2006-2022 Free Software Foundation, Inc. 4 // Written by Ian Lance Taylor <iant@google.com>. 5 6 // This file is part of elfcpp. 7 8 // This program is free software; you can redistribute it and/or 9 // modify it under the terms of the GNU Library General Public License 10 // as published by the Free Software Foundation; either version 2, or 11 // (at your option) any later version. 12 13 // In addition to the permissions in the GNU Library General Public 14 // License, the Free Software Foundation gives you unlimited 15 // permission to link the compiled version of this file into 16 // combinations with other programs, and to distribute those 17 // combinations without any restriction coming from the use of this 18 // file. (The Library Public License restrictions do apply in other 19 // respects; for example, they cover modification of the file, and 20 /// distribution when not linked into a combined executable.) 21 22 // This program is distributed in the hope that it will be useful, but 23 // WITHOUT ANY WARRANTY; without even the implied warranty of 24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 // Library General Public License for more details. 26 27 // You should have received a copy of the GNU Library General Public 28 // License along with this program; if not, write to the Free Software 29 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 30 // 02110-1301, USA. 31 32 #ifndef ELFCPP_DWARF_H 33 #define ELFCPP_DWARF_H 34 35 namespace elfcpp 36 { 37 38 // DWARF2 codes. 39 40 // Include DW_TAG, DW_FORM, DW_AT, DW_OP, DW_ATE, and DW_CFA 41 // codes from dwarf2.def. 42 43 #define DW_FIRST_TAG(name, value) enum DW_TAG { \ 44 name = value 45 #define DW_TAG(name, value) , name = value 46 #define DW_TAG_DUP(name, value) , name = value 47 #define DW_END_TAG }; 48 49 #define DW_FIRST_FORM(name, value) enum DW_FORM { \ 50 name = value 51 #define DW_FORM(name, value) , name = value 52 #define DW_END_FORM }; 53 54 #define DW_FIRST_AT(name, value) enum DW_AT { \ 55 name = value 56 #define DW_AT(name, value) , name = value 57 #define DW_AT_DUP(name, value) , name = value 58 #define DW_END_AT }; 59 60 #define DW_FIRST_OP(name, value) enum DW_OP { \ 61 name = value 62 #define DW_OP(name, value) , name = value 63 #define DW_OP_DUP(name, value) , name = value 64 #define DW_END_OP }; 65 66 #define DW_FIRST_ATE(name, value) enum DW_ENCODING { \ 67 name = value 68 #define DW_ATE(name, value) , name = value 69 #define DW_ATE_DUP(name, value) , name = value 70 #define DW_END_ATE }; 71 72 #define DW_FIRST_CFA(name, value) enum DW_CFA { \ 73 name = value 74 #define DW_CFA(name, value) , name = value 75 #define DW_CFA_DUP(name, value) , name = value 76 #define DW_END_CFA }; 77 78 #define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \ 79 name = value 80 #define DW_IDX(name, value) , name = value 81 #define DW_IDX_DUP(name, value) , name = value 82 #define DW_END_IDX }; 83 84 #define DW_FIRST_UT(name, value) enum dwarf_unit_type { \ 85 name = value 86 #define DW_UT(name, value) , name = value 87 #define DW_END_UT }; 88 89 #include "dwarf2.def" 90 91 #undef DW_FIRST_TAG 92 #undef DW_TAG 93 #undef DW_TAG_DUP 94 #undef DW_END_TAG 95 96 #undef DW_FIRST_FORM 97 #undef DW_FORM 98 #undef DW_END_FORM 99 100 #undef DW_FIRST_AT 101 #undef DW_AT 102 #undef DW_AT_DUP 103 #undef DW_END_AT 104 105 #undef DW_FIRST_OP 106 #undef DW_OP 107 #undef DW_OP_DUP 108 #undef DW_END_OP 109 110 #undef DW_FIRST_ATE 111 #undef DW_ATE 112 #undef DW_ATE_DUP 113 #undef DW_END_ATE 114 115 #undef DW_FIRST_CFA 116 #undef DW_CFA_DUP 117 #undef DW_CFA 118 #undef DW_END_CFA 119 120 #undef DW_FIRST_IDX 121 #undef DW_IDX 122 #undef DW_IDX_DUP 123 #undef DW_END_IDX 124 125 #undef DW_FIRST_UT 126 #undef DW_UT 127 #undef DW_END_UT 128 129 // Frame unwind information. 130 131 enum DW_EH_PE 132 { 133 DW_EH_PE_absptr = 0x00, 134 DW_EH_PE_omit = 0xff, 135 136 DW_EH_PE_uleb128 = 0x01, 137 DW_EH_PE_udata2 = 0x02, 138 DW_EH_PE_udata4 = 0x03, 139 DW_EH_PE_udata8 = 0x04, 140 DW_EH_PE_signed = 0x08, 141 DW_EH_PE_sleb128 = 0x09, 142 DW_EH_PE_sdata2 = 0x0a, 143 DW_EH_PE_sdata4 = 0x0b, 144 DW_EH_PE_sdata8 = 0x0c, 145 146 DW_EH_PE_pcrel = 0x10, 147 DW_EH_PE_textrel = 0x20, 148 DW_EH_PE_datarel = 0x30, 149 DW_EH_PE_funcrel = 0x40, 150 DW_EH_PE_aligned = 0x50, 151 152 DW_EH_PE_indirect = 0x80 153 }; 154 155 // Line number table content type codes. 156 157 enum DW_LNCT 158 { 159 DW_LNCT_path = 0x1, 160 DW_LNCT_directory_index = 0x2, 161 DW_LNCT_timestamp = 0x3, 162 DW_LNCT_size = 0x4, 163 DW_LNCT_MD5 = 0x5, 164 DW_LNCT_lo_user = 0x2000, 165 DW_LNCT_hi_user = 0x3fff 166 }; 167 168 // Line number opcodes. 169 170 enum DW_LINE_OPS 171 { 172 DW_LNS_extended_op = 0x00, 173 DW_LNS_copy = 0x01, 174 DW_LNS_advance_pc = 0x02, 175 DW_LNS_advance_line = 0x03, 176 DW_LNS_set_file = 0x04, 177 DW_LNS_set_column = 0x05, 178 DW_LNS_negate_stmt = 0x06, 179 DW_LNS_set_basic_block = 0x07, 180 DW_LNS_const_add_pc = 0x08, 181 DW_LNS_fixed_advance_pc = 0x09, 182 // DWARF 3. 183 DW_LNS_set_prologue_end = 0x0a, 184 DW_LNS_set_epilogue_begin = 0x0b, 185 DW_LNS_set_isa = 0x0c 186 }; 187 188 // Line number extended opcodes. 189 190 enum DW_LINE_EXTENDED_OPS 191 { 192 DW_LNE_end_sequence = 0x01, 193 DW_LNE_set_address = 0x02, 194 DW_LNE_define_file = 0x03, 195 // DWARF4. 196 DW_LNE_set_discriminator = 0x04, 197 // HP extensions. 198 DW_LNE_HP_negate_is_UV_update = 0x11, 199 DW_LNE_HP_push_context = 0x12, 200 DW_LNE_HP_pop_context = 0x13, 201 DW_LNE_HP_set_file_line_column = 0x14, 202 DW_LNE_HP_set_routine_name = 0x15, 203 DW_LNE_HP_set_sequence = 0x16, 204 DW_LNE_HP_negate_post_semantics = 0x17, 205 DW_LNE_HP_negate_function_exit = 0x18, 206 DW_LNE_HP_negate_front_end_logical = 0x19, 207 DW_LNE_HP_define_proc = 0x20, 208 DW_LNE_lo_user = 0x80, 209 DW_LNE_hi_user = 0xff 210 }; 211 212 enum DW_CHILDREN 213 { 214 DW_CHILDREN_no = 0, 215 DW_CHILDREN_yes = 1 216 }; 217 218 // Source language names and codes. 219 enum DW_LANG 220 { 221 DW_LANG_C89 = 0x0001, 222 DW_LANG_C = 0x0002, 223 DW_LANG_Ada83 = 0x0003, 224 DW_LANG_C_plus_plus = 0x0004, 225 DW_LANG_Cobol74 = 0x0005, 226 DW_LANG_Cobol85 = 0x0006, 227 DW_LANG_Fortran77 = 0x0007, 228 DW_LANG_Fortran90 = 0x0008, 229 DW_LANG_Pascal83 = 0x0009, 230 DW_LANG_Modula2 = 0x000a, 231 // DWARF 3. 232 DW_LANG_Java = 0x000b, 233 DW_LANG_C99 = 0x000c, 234 DW_LANG_Ada95 = 0x000d, 235 DW_LANG_Fortran95 = 0x000e, 236 DW_LANG_PLI = 0x000f, 237 DW_LANG_ObjC = 0x0010, 238 DW_LANG_ObjC_plus_plus = 0x0011, 239 DW_LANG_UPC = 0x0012, 240 DW_LANG_D = 0x0013, 241 // DWARF 4. 242 DW_LANG_Python = 0x0014, 243 // DWARF 5. 244 DW_LANG_Go = 0x0016, 245 DW_LANG_C_plus_plus_11 = 0x001a, 246 DW_LANG_C11 = 0x001d, 247 DW_LANG_C_plus_plus_14 = 0x0021, 248 DW_LANG_Fortran03 = 0x0022, 249 DW_LANG_Fortran08 = 0x0023, 250 251 DW_LANG_lo_user = 0x8000, // Implementation-defined range start. 252 DW_LANG_hi_user = 0xffff, // Implementation-defined range start. 253 // MIPS. 254 DW_LANG_Mips_Assembler = 0x8001, 255 // UPC. 256 DW_LANG_Upc = 0x8765, 257 // HP extensions. 258 DW_LANG_HP_Bliss = 0x8003, 259 DW_LANG_HP_Basic91 = 0x8004, 260 DW_LANG_HP_Pascal91 = 0x8005, 261 DW_LANG_HP_IMacro = 0x8006, 262 DW_LANG_HP_Assembler = 0x8007 263 }; 264 265 // Range list entry kinds in .debug_rnglists* section. 266 267 enum DW_RLE 268 { 269 DW_RLE_end_of_list = 0x00, 270 DW_RLE_base_addressx = 0x01, 271 DW_RLE_startx_endx = 0x02, 272 DW_RLE_startx_length = 0x03, 273 DW_RLE_offset_pair = 0x04, 274 DW_RLE_base_address = 0x05, 275 DW_RLE_start_end = 0x06, 276 DW_RLE_start_length = 0x07 277 }; 278 279 // DWARF section identifiers used in the package format. 280 // Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFissionDWP. 281 // Added (with changes) in DWARF 5. 282 283 enum DW_SECT 284 { 285 DW_SECT_INFO = 1, 286 DW_SECT_ABBREV = 3, 287 DW_SECT_LINE = 4, 288 DW_SECT_LOCLISTS = 5, 289 DW_SECT_STR_OFFSETS = 6, 290 DW_SECT_MACINFO = 7, 291 DW_SECT_RNGLISTS = 8, 292 DW_SECT_MAX = DW_SECT_RNGLISTS, 293 // These were used only for the experimental Fission support in DWARF 4. 294 DW_SECT_TYPES = 2, 295 DW_SECT_LOC = 5, 296 DW_SECT_MACRO = 8 297 }; 298 299 } // End namespace elfcpp. 300 301 #endif // !defined(ELFCPP_DWARF_H) 302