1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16// TODO: Add other DW-based macros. 17#if !( \ 18 defined DW_TAG || defined DW_AT || defined DW_FORM || \ 19 defined DW_OP || defined DW_LANG || defined DW_ATE) 20#error "Missing definition of DW*" 21#endif 22 23#ifndef DW_TAG 24#define DW_TAG(ID, NAME) 25#endif 26 27#ifndef DW_AT 28#define DW_AT(ID, NAME) 29#endif 30 31#ifndef DW_FORM 32#define DW_FORM(ID, NAME) 33#endif 34 35#ifndef DW_OP 36#define DW_OP(ID, NAME) 37#endif 38 39#ifndef DW_LANG 40#define DW_LANG(ID, NAME, LOWER_BOUND) 41#endif 42 43#ifndef DW_ATE 44#define DW_ATE(ID, NAME) 45#endif 46 47// Tag 48DW_TAG(0x0000, null) 49DW_TAG(0x0001, array_type) 50DW_TAG(0x0002, class_type) 51DW_TAG(0x0004, enumeration_type) 52DW_TAG(0x0005, formal_parameter) 53DW_TAG(0x000a, label) 54DW_TAG(0x000b, lexical_block) 55DW_TAG(0x000d, member) 56DW_TAG(0x000f, pointer_type) 57DW_TAG(0x0011, compile_unit) 58DW_TAG(0x0013, structure_type) 59DW_TAG(0x0015, subroutine_type) 60DW_TAG(0x0016, typedef) 61DW_TAG(0x0017, union_type) 62DW_TAG(0x0018, unspecified_parameters) 63DW_TAG(0x001c, inheritance) 64DW_TAG(0x0021, subrange_type) 65DW_TAG(0x0024, base_type) 66DW_TAG(0x0026, const_type) 67DW_TAG(0x0028, enumerator) 68DW_TAG(0x002e, subprogram) 69DW_TAG(0x0034, variable) 70DW_TAG(0x0035, volatile_type) 71// New in DWARF v3 72DW_TAG(0x0038, interface_type) 73 74// Attributes 75DW_AT(0x01, sibling) 76DW_AT(0x02, location) 77DW_AT(0x03, name) 78DW_AT(0x0b, byte_size) 79DW_AT(0x0c, bit_offset) 80DW_AT(0x0d, bit_size) 81DW_AT(0x10, stmt_list) 82DW_AT(0x11, low_pc) 83DW_AT(0x12, high_pc) 84DW_AT(0x13, language) 85DW_AT(0x1b, comp_dir) 86DW_AT(0x1c, const_value) 87DW_AT(0x25, producer) 88DW_AT(0x27, prototyped) 89DW_AT(0x2f, upper_bound) 90DW_AT(0x32, accessibility) 91DW_AT(0x38, data_member_location) 92DW_AT(0x39, decl_column) 93DW_AT(0x3a, decl_file) 94DW_AT(0x3b, decl_line) 95DW_AT(0x3e, encoding) 96DW_AT(0x3f, external) 97DW_AT(0x40, frame_base) 98DW_AT(0x47, specification) 99DW_AT(0x49, type) 100// New in DWARF v3 101DW_AT(0x64, object_pointer) 102// New in DWARF v5 103DW_AT(0x8a, deleted) 104// Vendor extensions 105DW_AT (0x2116, GNU_all_tail_call_sites) 106 107// Attribute form encodings 108DW_FORM(0x01, addr) 109DW_FORM(0x05, data2) 110DW_FORM(0x06, data4) 111DW_FORM(0x07, data8) 112DW_FORM(0x08, string) 113DW_FORM(0x0b, data1) 114DW_FORM(0x0c, flag) 115DW_FORM(0x0e, strp) 116DW_FORM(0x10, ref_addr) 117DW_FORM(0x11, ref1) 118DW_FORM(0x12, ref2) 119DW_FORM(0x13, ref4) 120DW_FORM(0x14, ref8) 121// New in DWARF v4 122DW_FORM(0x17, sec_offset) 123DW_FORM(0x18, exprloc) 124DW_FORM(0x19, flag_present) 125// This was defined out of sequence. 126DW_FORM(0x20, ref_sig8) 127// Alternate debug sections proposal (output of "dwz" tool). 128DW_FORM(0x1f20, GNU_ref_alt) 129DW_FORM(0x1f21, GNU_strp_alt) 130 131// DWARF Expression operators. 132DW_OP(0x03, addr) 133DW_OP(0x70, breg0) 134DW_OP(0x71, breg1) 135DW_OP(0x72, breg2) 136DW_OP(0x73, breg3) 137DW_OP(0x74, breg4) 138DW_OP(0x75, breg5) 139DW_OP(0x76, breg6) 140DW_OP(0x77, breg7) 141DW_OP(0x91, fbreg) 142// New in DWARF v3 143DW_OP(0x9c, call_frame_cfa) 144 145// DWARF languages. 146DW_LANG(0x000c, C99, 0) 147 148// DWARF attribute type encodings. 149DW_ATE(0x01, address) 150DW_ATE(0x02, boolean) 151DW_ATE(0x03, complex_float) 152DW_ATE(0x04, float) 153DW_ATE(0x05, signed) 154DW_ATE(0x06, signed_char) 155DW_ATE(0x07, unsigned) 156DW_ATE(0x08, unsigned_char) 157 158#undef DW_TAG 159#undef DW_AT 160#undef DW_FORM 161#undef DW_OP 162#undef DW_LANG 163#undef DW_ATE 164