Index: lldb/include/lldb/Core/dwarf.h =================================================================== --- lldb/include/lldb/Core/dwarf.h +++ lldb/include/lldb/Core/dwarf.h @@ -15,9 +15,6 @@ // Get the DWARF constant definitions from llvm #include "llvm/BinaryFormat/Dwarf.h" -// and stuff them in our default namespace -using namespace llvm::dwarf; - typedef uint32_t dw_uleb128_t; typedef int32_t dw_sleb128_t; typedef uint16_t dw_attr_t; Index: lldb/include/lldb/Symbol/DWARFCallFrameInfo.h =================================================================== --- lldb/include/lldb/Symbol/DWARFCallFrameInfo.h +++ lldb/include/lldb/Symbol/DWARFCallFrameInfo.h @@ -106,7 +106,8 @@ CIE(dw_offset_t offset) : cie_offset(offset), version(-1), code_align(0), data_align(0), return_addr_reg_num(LLDB_INVALID_REGNUM), inst_offset(0), - inst_length(0), ptr_encoding(0), lsda_addr_encoding(DW_EH_PE_omit), + inst_length(0), ptr_encoding(0), + lsda_addr_encoding(llvm::dwarf::DW_EH_PE_omit), personality_loc(LLDB_INVALID_ADDRESS) {} }; Index: lldb/source/Expression/DWARFExpression.cpp =================================================================== --- lldb/source/Expression/DWARFExpression.cpp +++ lldb/source/Expression/DWARFExpression.cpp @@ -206,199 +206,203 @@ const uint8_t op) { lldb::offset_t offset = data_offset; switch (op) { - case DW_OP_addr: - case DW_OP_call_ref: // 0x9a 1 address sized offset of DIE (DWARF3) + case llvm::dwarf::DW_OP_addr: + case llvm::dwarf::DW_OP_call_ref: // 0x9a 1 address sized offset of DIE + // (DWARF3) return data.GetAddressByteSize(); // Opcodes with no arguments - case DW_OP_deref: // 0x06 - case DW_OP_dup: // 0x12 - case DW_OP_drop: // 0x13 - case DW_OP_over: // 0x14 - case DW_OP_swap: // 0x16 - case DW_OP_rot: // 0x17 - case DW_OP_xderef: // 0x18 - case DW_OP_abs: // 0x19 - case DW_OP_and: // 0x1a - case DW_OP_div: // 0x1b - case DW_OP_minus: // 0x1c - case DW_OP_mod: // 0x1d - case DW_OP_mul: // 0x1e - case DW_OP_neg: // 0x1f - case DW_OP_not: // 0x20 - case DW_OP_or: // 0x21 - case DW_OP_plus: // 0x22 - case DW_OP_shl: // 0x24 - case DW_OP_shr: // 0x25 - case DW_OP_shra: // 0x26 - case DW_OP_xor: // 0x27 - case DW_OP_eq: // 0x29 - case DW_OP_ge: // 0x2a - case DW_OP_gt: // 0x2b - case DW_OP_le: // 0x2c - case DW_OP_lt: // 0x2d - case DW_OP_ne: // 0x2e - case DW_OP_lit0: // 0x30 - case DW_OP_lit1: // 0x31 - case DW_OP_lit2: // 0x32 - case DW_OP_lit3: // 0x33 - case DW_OP_lit4: // 0x34 - case DW_OP_lit5: // 0x35 - case DW_OP_lit6: // 0x36 - case DW_OP_lit7: // 0x37 - case DW_OP_lit8: // 0x38 - case DW_OP_lit9: // 0x39 - case DW_OP_lit10: // 0x3A - case DW_OP_lit11: // 0x3B - case DW_OP_lit12: // 0x3C - case DW_OP_lit13: // 0x3D - case DW_OP_lit14: // 0x3E - case DW_OP_lit15: // 0x3F - case DW_OP_lit16: // 0x40 - case DW_OP_lit17: // 0x41 - case DW_OP_lit18: // 0x42 - case DW_OP_lit19: // 0x43 - case DW_OP_lit20: // 0x44 - case DW_OP_lit21: // 0x45 - case DW_OP_lit22: // 0x46 - case DW_OP_lit23: // 0x47 - case DW_OP_lit24: // 0x48 - case DW_OP_lit25: // 0x49 - case DW_OP_lit26: // 0x4A - case DW_OP_lit27: // 0x4B - case DW_OP_lit28: // 0x4C - case DW_OP_lit29: // 0x4D - case DW_OP_lit30: // 0x4E - case DW_OP_lit31: // 0x4f - case DW_OP_reg0: // 0x50 - case DW_OP_reg1: // 0x51 - case DW_OP_reg2: // 0x52 - case DW_OP_reg3: // 0x53 - case DW_OP_reg4: // 0x54 - case DW_OP_reg5: // 0x55 - case DW_OP_reg6: // 0x56 - case DW_OP_reg7: // 0x57 - case DW_OP_reg8: // 0x58 - case DW_OP_reg9: // 0x59 - case DW_OP_reg10: // 0x5A - case DW_OP_reg11: // 0x5B - case DW_OP_reg12: // 0x5C - case DW_OP_reg13: // 0x5D - case DW_OP_reg14: // 0x5E - case DW_OP_reg15: // 0x5F - case DW_OP_reg16: // 0x60 - case DW_OP_reg17: // 0x61 - case DW_OP_reg18: // 0x62 - case DW_OP_reg19: // 0x63 - case DW_OP_reg20: // 0x64 - case DW_OP_reg21: // 0x65 - case DW_OP_reg22: // 0x66 - case DW_OP_reg23: // 0x67 - case DW_OP_reg24: // 0x68 - case DW_OP_reg25: // 0x69 - case DW_OP_reg26: // 0x6A - case DW_OP_reg27: // 0x6B - case DW_OP_reg28: // 0x6C - case DW_OP_reg29: // 0x6D - case DW_OP_reg30: // 0x6E - case DW_OP_reg31: // 0x6F - case DW_OP_nop: // 0x96 - case DW_OP_push_object_address: // 0x97 DWARF3 - case DW_OP_form_tls_address: // 0x9b DWARF3 - case DW_OP_call_frame_cfa: // 0x9c DWARF3 - case DW_OP_stack_value: // 0x9f DWARF4 - case DW_OP_GNU_push_tls_address: // 0xe0 GNU extension + case llvm::dwarf::DW_OP_deref: // 0x06 + case llvm::dwarf::DW_OP_dup: // 0x12 + case llvm::dwarf::DW_OP_drop: // 0x13 + case llvm::dwarf::DW_OP_over: // 0x14 + case llvm::dwarf::DW_OP_swap: // 0x16 + case llvm::dwarf::DW_OP_rot: // 0x17 + case llvm::dwarf::DW_OP_xderef: // 0x18 + case llvm::dwarf::DW_OP_abs: // 0x19 + case llvm::dwarf::DW_OP_and: // 0x1a + case llvm::dwarf::DW_OP_div: // 0x1b + case llvm::dwarf::DW_OP_minus: // 0x1c + case llvm::dwarf::DW_OP_mod: // 0x1d + case llvm::dwarf::DW_OP_mul: // 0x1e + case llvm::dwarf::DW_OP_neg: // 0x1f + case llvm::dwarf::DW_OP_not: // 0x20 + case llvm::dwarf::DW_OP_or: // 0x21 + case llvm::dwarf::DW_OP_plus: // 0x22 + case llvm::dwarf::DW_OP_shl: // 0x24 + case llvm::dwarf::DW_OP_shr: // 0x25 + case llvm::dwarf::DW_OP_shra: // 0x26 + case llvm::dwarf::DW_OP_xor: // 0x27 + case llvm::dwarf::DW_OP_eq: // 0x29 + case llvm::dwarf::DW_OP_ge: // 0x2a + case llvm::dwarf::DW_OP_gt: // 0x2b + case llvm::dwarf::DW_OP_le: // 0x2c + case llvm::dwarf::DW_OP_lt: // 0x2d + case llvm::dwarf::DW_OP_ne: // 0x2e + case llvm::dwarf::DW_OP_lit0: // 0x30 + case llvm::dwarf::DW_OP_lit1: // 0x31 + case llvm::dwarf::DW_OP_lit2: // 0x32 + case llvm::dwarf::DW_OP_lit3: // 0x33 + case llvm::dwarf::DW_OP_lit4: // 0x34 + case llvm::dwarf::DW_OP_lit5: // 0x35 + case llvm::dwarf::DW_OP_lit6: // 0x36 + case llvm::dwarf::DW_OP_lit7: // 0x37 + case llvm::dwarf::DW_OP_lit8: // 0x38 + case llvm::dwarf::DW_OP_lit9: // 0x39 + case llvm::dwarf::DW_OP_lit10: // 0x3A + case llvm::dwarf::DW_OP_lit11: // 0x3B + case llvm::dwarf::DW_OP_lit12: // 0x3C + case llvm::dwarf::DW_OP_lit13: // 0x3D + case llvm::dwarf::DW_OP_lit14: // 0x3E + case llvm::dwarf::DW_OP_lit15: // 0x3F + case llvm::dwarf::DW_OP_lit16: // 0x40 + case llvm::dwarf::DW_OP_lit17: // 0x41 + case llvm::dwarf::DW_OP_lit18: // 0x42 + case llvm::dwarf::DW_OP_lit19: // 0x43 + case llvm::dwarf::DW_OP_lit20: // 0x44 + case llvm::dwarf::DW_OP_lit21: // 0x45 + case llvm::dwarf::DW_OP_lit22: // 0x46 + case llvm::dwarf::DW_OP_lit23: // 0x47 + case llvm::dwarf::DW_OP_lit24: // 0x48 + case llvm::dwarf::DW_OP_lit25: // 0x49 + case llvm::dwarf::DW_OP_lit26: // 0x4A + case llvm::dwarf::DW_OP_lit27: // 0x4B + case llvm::dwarf::DW_OP_lit28: // 0x4C + case llvm::dwarf::DW_OP_lit29: // 0x4D + case llvm::dwarf::DW_OP_lit30: // 0x4E + case llvm::dwarf::DW_OP_lit31: // 0x4f + case llvm::dwarf::DW_OP_reg0: // 0x50 + case llvm::dwarf::DW_OP_reg1: // 0x51 + case llvm::dwarf::DW_OP_reg2: // 0x52 + case llvm::dwarf::DW_OP_reg3: // 0x53 + case llvm::dwarf::DW_OP_reg4: // 0x54 + case llvm::dwarf::DW_OP_reg5: // 0x55 + case llvm::dwarf::DW_OP_reg6: // 0x56 + case llvm::dwarf::DW_OP_reg7: // 0x57 + case llvm::dwarf::DW_OP_reg8: // 0x58 + case llvm::dwarf::DW_OP_reg9: // 0x59 + case llvm::dwarf::DW_OP_reg10: // 0x5A + case llvm::dwarf::DW_OP_reg11: // 0x5B + case llvm::dwarf::DW_OP_reg12: // 0x5C + case llvm::dwarf::DW_OP_reg13: // 0x5D + case llvm::dwarf::DW_OP_reg14: // 0x5E + case llvm::dwarf::DW_OP_reg15: // 0x5F + case llvm::dwarf::DW_OP_reg16: // 0x60 + case llvm::dwarf::DW_OP_reg17: // 0x61 + case llvm::dwarf::DW_OP_reg18: // 0x62 + case llvm::dwarf::DW_OP_reg19: // 0x63 + case llvm::dwarf::DW_OP_reg20: // 0x64 + case llvm::dwarf::DW_OP_reg21: // 0x65 + case llvm::dwarf::DW_OP_reg22: // 0x66 + case llvm::dwarf::DW_OP_reg23: // 0x67 + case llvm::dwarf::DW_OP_reg24: // 0x68 + case llvm::dwarf::DW_OP_reg25: // 0x69 + case llvm::dwarf::DW_OP_reg26: // 0x6A + case llvm::dwarf::DW_OP_reg27: // 0x6B + case llvm::dwarf::DW_OP_reg28: // 0x6C + case llvm::dwarf::DW_OP_reg29: // 0x6D + case llvm::dwarf::DW_OP_reg30: // 0x6E + case llvm::dwarf::DW_OP_reg31: // 0x6F + case llvm::dwarf::DW_OP_nop: // 0x96 + case llvm::dwarf::DW_OP_push_object_address: // 0x97 DWARF3 + case llvm::dwarf::DW_OP_form_tls_address: // 0x9b DWARF3 + case llvm::dwarf::DW_OP_call_frame_cfa: // 0x9c DWARF3 + case llvm::dwarf::DW_OP_stack_value: // 0x9f DWARF4 + case llvm::dwarf::DW_OP_GNU_push_tls_address: // 0xe0 GNU extension return 0; // Opcodes with a single 1 byte arguments - case DW_OP_const1u: // 0x08 1 1-byte constant - case DW_OP_const1s: // 0x09 1 1-byte constant - case DW_OP_pick: // 0x15 1 1-byte stack index - case DW_OP_deref_size: // 0x94 1 1-byte size of data retrieved - case DW_OP_xderef_size: // 0x95 1 1-byte size of data retrieved + case llvm::dwarf::DW_OP_const1u: // 0x08 1 1-byte constant + case llvm::dwarf::DW_OP_const1s: // 0x09 1 1-byte constant + case llvm::dwarf::DW_OP_pick: // 0x15 1 1-byte stack index + case llvm::dwarf::DW_OP_deref_size: // 0x94 1 1-byte size of data retrieved + case llvm::dwarf::DW_OP_xderef_size: // 0x95 1 1-byte size of data retrieved return 1; // Opcodes with a single 2 byte arguments - case DW_OP_const2u: // 0x0a 1 2-byte constant - case DW_OP_const2s: // 0x0b 1 2-byte constant - case DW_OP_skip: // 0x2f 1 signed 2-byte constant - case DW_OP_bra: // 0x28 1 signed 2-byte constant - case DW_OP_call2: // 0x98 1 2-byte offset of DIE (DWARF3) + case llvm::dwarf::DW_OP_const2u: // 0x0a 1 2-byte constant + case llvm::dwarf::DW_OP_const2s: // 0x0b 1 2-byte constant + case llvm::dwarf::DW_OP_skip: // 0x2f 1 signed 2-byte constant + case llvm::dwarf::DW_OP_bra: // 0x28 1 signed 2-byte constant + case llvm::dwarf::DW_OP_call2: // 0x98 1 2-byte offset of DIE (DWARF3) return 2; // Opcodes with a single 4 byte arguments - case DW_OP_const4u: // 0x0c 1 4-byte constant - case DW_OP_const4s: // 0x0d 1 4-byte constant - case DW_OP_call4: // 0x99 1 4-byte offset of DIE (DWARF3) + case llvm::dwarf::DW_OP_const4u: // 0x0c 1 4-byte constant + case llvm::dwarf::DW_OP_const4s: // 0x0d 1 4-byte constant + case llvm::dwarf::DW_OP_call4: // 0x99 1 4-byte offset of DIE (DWARF3) return 4; // Opcodes with a single 8 byte arguments - case DW_OP_const8u: // 0x0e 1 8-byte constant - case DW_OP_const8s: // 0x0f 1 8-byte constant + case llvm::dwarf::DW_OP_const8u: // 0x0e 1 8-byte constant + case llvm::dwarf::DW_OP_const8s: // 0x0f 1 8-byte constant return 8; // All opcodes that have a single ULEB (signed or unsigned) argument - case DW_OP_addrx: // 0xa1 1 ULEB128 index - case DW_OP_constu: // 0x10 1 ULEB128 constant - case DW_OP_consts: // 0x11 1 SLEB128 constant - case DW_OP_plus_uconst: // 0x23 1 ULEB128 addend - case DW_OP_breg0: // 0x70 1 ULEB128 register - case DW_OP_breg1: // 0x71 1 ULEB128 register - case DW_OP_breg2: // 0x72 1 ULEB128 register - case DW_OP_breg3: // 0x73 1 ULEB128 register - case DW_OP_breg4: // 0x74 1 ULEB128 register - case DW_OP_breg5: // 0x75 1 ULEB128 register - case DW_OP_breg6: // 0x76 1 ULEB128 register - case DW_OP_breg7: // 0x77 1 ULEB128 register - case DW_OP_breg8: // 0x78 1 ULEB128 register - case DW_OP_breg9: // 0x79 1 ULEB128 register - case DW_OP_breg10: // 0x7a 1 ULEB128 register - case DW_OP_breg11: // 0x7b 1 ULEB128 register - case DW_OP_breg12: // 0x7c 1 ULEB128 register - case DW_OP_breg13: // 0x7d 1 ULEB128 register - case DW_OP_breg14: // 0x7e 1 ULEB128 register - case DW_OP_breg15: // 0x7f 1 ULEB128 register - case DW_OP_breg16: // 0x80 1 ULEB128 register - case DW_OP_breg17: // 0x81 1 ULEB128 register - case DW_OP_breg18: // 0x82 1 ULEB128 register - case DW_OP_breg19: // 0x83 1 ULEB128 register - case DW_OP_breg20: // 0x84 1 ULEB128 register - case DW_OP_breg21: // 0x85 1 ULEB128 register - case DW_OP_breg22: // 0x86 1 ULEB128 register - case DW_OP_breg23: // 0x87 1 ULEB128 register - case DW_OP_breg24: // 0x88 1 ULEB128 register - case DW_OP_breg25: // 0x89 1 ULEB128 register - case DW_OP_breg26: // 0x8a 1 ULEB128 register - case DW_OP_breg27: // 0x8b 1 ULEB128 register - case DW_OP_breg28: // 0x8c 1 ULEB128 register - case DW_OP_breg29: // 0x8d 1 ULEB128 register - case DW_OP_breg30: // 0x8e 1 ULEB128 register - case DW_OP_breg31: // 0x8f 1 ULEB128 register - case DW_OP_regx: // 0x90 1 ULEB128 register - case DW_OP_fbreg: // 0x91 1 SLEB128 offset - case DW_OP_piece: // 0x93 1 ULEB128 size of piece addressed - case DW_OP_GNU_addr_index: // 0xfb 1 ULEB128 index - case DW_OP_GNU_const_index: // 0xfc 1 ULEB128 index + case llvm::dwarf::DW_OP_addrx: // 0xa1 1 ULEB128 index + case llvm::dwarf::DW_OP_constu: // 0x10 1 ULEB128 constant + case llvm::dwarf::DW_OP_consts: // 0x11 1 SLEB128 constant + case llvm::dwarf::DW_OP_plus_uconst: // 0x23 1 ULEB128 addend + case llvm::dwarf::DW_OP_breg0: // 0x70 1 ULEB128 register + case llvm::dwarf::DW_OP_breg1: // 0x71 1 ULEB128 register + case llvm::dwarf::DW_OP_breg2: // 0x72 1 ULEB128 register + case llvm::dwarf::DW_OP_breg3: // 0x73 1 ULEB128 register + case llvm::dwarf::DW_OP_breg4: // 0x74 1 ULEB128 register + case llvm::dwarf::DW_OP_breg5: // 0x75 1 ULEB128 register + case llvm::dwarf::DW_OP_breg6: // 0x76 1 ULEB128 register + case llvm::dwarf::DW_OP_breg7: // 0x77 1 ULEB128 register + case llvm::dwarf::DW_OP_breg8: // 0x78 1 ULEB128 register + case llvm::dwarf::DW_OP_breg9: // 0x79 1 ULEB128 register + case llvm::dwarf::DW_OP_breg10: // 0x7a 1 ULEB128 register + case llvm::dwarf::DW_OP_breg11: // 0x7b 1 ULEB128 register + case llvm::dwarf::DW_OP_breg12: // 0x7c 1 ULEB128 register + case llvm::dwarf::DW_OP_breg13: // 0x7d 1 ULEB128 register + case llvm::dwarf::DW_OP_breg14: // 0x7e 1 ULEB128 register + case llvm::dwarf::DW_OP_breg15: // 0x7f 1 ULEB128 register + case llvm::dwarf::DW_OP_breg16: // 0x80 1 ULEB128 register + case llvm::dwarf::DW_OP_breg17: // 0x81 1 ULEB128 register + case llvm::dwarf::DW_OP_breg18: // 0x82 1 ULEB128 register + case llvm::dwarf::DW_OP_breg19: // 0x83 1 ULEB128 register + case llvm::dwarf::DW_OP_breg20: // 0x84 1 ULEB128 register + case llvm::dwarf::DW_OP_breg21: // 0x85 1 ULEB128 register + case llvm::dwarf::DW_OP_breg22: // 0x86 1 ULEB128 register + case llvm::dwarf::DW_OP_breg23: // 0x87 1 ULEB128 register + case llvm::dwarf::DW_OP_breg24: // 0x88 1 ULEB128 register + case llvm::dwarf::DW_OP_breg25: // 0x89 1 ULEB128 register + case llvm::dwarf::DW_OP_breg26: // 0x8a 1 ULEB128 register + case llvm::dwarf::DW_OP_breg27: // 0x8b 1 ULEB128 register + case llvm::dwarf::DW_OP_breg28: // 0x8c 1 ULEB128 register + case llvm::dwarf::DW_OP_breg29: // 0x8d 1 ULEB128 register + case llvm::dwarf::DW_OP_breg30: // 0x8e 1 ULEB128 register + case llvm::dwarf::DW_OP_breg31: // 0x8f 1 ULEB128 register + case llvm::dwarf::DW_OP_regx: // 0x90 1 ULEB128 register + case llvm::dwarf::DW_OP_fbreg: // 0x91 1 SLEB128 offset + case llvm::dwarf::DW_OP_piece: // 0x93 1 ULEB128 size of piece addressed + case llvm::dwarf::DW_OP_GNU_addr_index: // 0xfb 1 ULEB128 index + case llvm::dwarf::DW_OP_GNU_const_index: // 0xfc 1 ULEB128 index data.Skip_LEB128(&offset); return offset - data_offset; // All opcodes that have a 2 ULEB (signed or unsigned) arguments - case DW_OP_bregx: // 0x92 2 ULEB128 register followed by SLEB128 offset - case DW_OP_bit_piece: // 0x9d ULEB128 bit size, ULEB128 bit offset (DWARF3); + case llvm::dwarf::DW_OP_bregx: // 0x92 2 ULEB128 register followed by SLEB128 + // offset + case llvm::dwarf::DW_OP_bit_piece: // 0x9d ULEB128 bit size, ULEB128 bit + // offset (DWARF3); data.Skip_LEB128(&offset); data.Skip_LEB128(&offset); return offset - data_offset; - case DW_OP_implicit_value: // 0x9e ULEB128 size followed by block of that size - // (DWARF4) + case llvm::dwarf::DW_OP_implicit_value: // 0x9e ULEB128 size followed by block + // of that size (DWARF4) { uint64_t block_len = data.Skip_LEB128(&offset); offset += block_len; return offset - data_offset; } - case DW_OP_GNU_entry_value: - case DW_OP_entry_value: // 0xa3 ULEB128 size + variable-length block + case llvm::dwarf::DW_OP_GNU_entry_value: + case llvm::dwarf::DW_OP_entry_value: // 0xa3 ULEB128 size + variable-length + // block { uint64_t subexpr_len = data.GetULEB128(&offset); return (offset - data_offset) + subexpr_len; @@ -420,13 +424,14 @@ while (m_data.ValidOffset(offset)) { const uint8_t op = m_data.GetU8(&offset); - if (op == DW_OP_addr) { + if (op == llvm::dwarf::DW_OP_addr) { const lldb::addr_t op_file_addr = m_data.GetAddress(&offset); if (curr_op_addr_idx == op_addr_idx) return op_file_addr; else ++curr_op_addr_idx; - } else if (op == DW_OP_GNU_addr_index || op == DW_OP_addrx) { + } else if (op == llvm::dwarf::DW_OP_GNU_addr_index || + op == llvm::dwarf::DW_OP_addrx) { uint64_t index = m_data.GetULEB128(&offset); if (curr_op_addr_idx == op_addr_idx) { if (!m_dwarf_cu) { @@ -456,7 +461,7 @@ while (m_data.ValidOffset(offset)) { const uint8_t op = m_data.GetU8(&offset); - if (op == DW_OP_addr) { + if (op == llvm::dwarf::DW_OP_addr) { const uint32_t addr_byte_size = m_data.GetAddressByteSize(); // We have to make a copy of the data as we don't know if this data is // from a read only memory mapped buffer, so we duplicate all of the data @@ -497,7 +502,8 @@ while (m_data.ValidOffset(offset)) { const uint8_t op = m_data.GetU8(&offset); - if (op == DW_OP_form_tls_address || op == DW_OP_GNU_push_tls_address) + if (op == llvm::dwarf::DW_OP_form_tls_address || + op == llvm::dwarf::DW_OP_GNU_push_tls_address) return true; const offset_t op_arg_size = GetOpcodeDataSize(m_data, offset, op); if (op_arg_size == LLDB_INVALID_OFFSET) @@ -537,7 +543,7 @@ bool decoded_data = false; switch (op) { - case DW_OP_const4u: + case llvm::dwarf::DW_OP_const4u: // Remember the const offset in case we later have a // DW_OP_form_tls_address or DW_OP_GNU_push_tls_address const_offset = offset; @@ -546,17 +552,17 @@ const_byte_size = 4; break; - case DW_OP_const8u: + case llvm::dwarf::DW_OP_const8u: // Remember the const offset in case we later have a - // DW_OP_form_tls_address or DW_OP_GNU_push_tls_address + // llvm::dwarf::DW_OP_form_tls_address or DW_OP_GNU_push_tls_address const_offset = offset; const_value = m_data.GetU64(&offset); decoded_data = true; const_byte_size = 8; break; - case DW_OP_form_tls_address: - case DW_OP_GNU_push_tls_address: + case llvm::dwarf::DW_OP_form_tls_address: + case llvm::dwarf::DW_OP_GNU_push_tls_address: // DW_OP_form_tls_address and DW_OP_GNU_push_tls_address must be preceded // by a file address on the stack. We assume that DW_OP_const4u or // DW_OP_const8u is used for these values, and we check that the last @@ -950,6 +956,7 @@ const DWARFUnit *dwarf_cu, const lldb::RegisterKind reg_kind, const Value *initial_value_ptr, const Value *object_address_ptr, Value &result, Status *error_ptr) { + using namespace llvm::dwarf; if (opcodes.GetByteSize() == 0) { if (error_ptr) @@ -2749,7 +2756,7 @@ lldb::offset_t op_offset = 0; uint8_t opcode = opcodes.GetU8(&op_offset); - if (opcode == DW_OP_fbreg) { + if (opcode == llvm::dwarf::DW_OP_fbreg) { int64_t offset = opcodes.GetSLEB128(&op_offset); DWARFExpression *fb_expr = frame.GetFrameBaseExpression(nullptr); @@ -2777,15 +2784,18 @@ const RegisterInfo *reg = nullptr; int64_t offset = 0; - if (opcode >= DW_OP_reg0 && opcode <= DW_OP_reg31) { - reg = reg_ctx_sp->GetRegisterInfo(m_reg_kind, opcode - DW_OP_reg0); - } else if (opcode >= DW_OP_breg0 && opcode <= DW_OP_breg31) { + if (opcode >= llvm::dwarf::DW_OP_reg0 && opcode <= llvm::dwarf::DW_OP_reg31) { + reg = reg_ctx_sp->GetRegisterInfo(m_reg_kind, + opcode - llvm::dwarf::DW_OP_reg0); + } else if (opcode >= llvm::dwarf::DW_OP_breg0 && + opcode <= llvm::dwarf::DW_OP_breg31) { offset = opcodes.GetSLEB128(&op_offset); - reg = reg_ctx_sp->GetRegisterInfo(m_reg_kind, opcode - DW_OP_breg0); - } else if (opcode == DW_OP_regx) { + reg = reg_ctx_sp->GetRegisterInfo(m_reg_kind, + opcode - llvm::dwarf::DW_OP_breg0); + } else if (opcode == llvm::dwarf::DW_OP_regx) { uint32_t reg_num = static_cast(opcodes.GetULEB128(&op_offset)); reg = reg_ctx_sp->GetRegisterInfo(m_reg_kind, reg_num); - } else if (opcode == DW_OP_bregx) { + } else if (opcode == llvm::dwarf::DW_OP_bregx) { uint32_t reg_num = static_cast(opcodes.GetULEB128(&op_offset)); offset = opcodes.GetSLEB128(&op_offset); reg = reg_ctx_sp->GetRegisterInfo(m_reg_kind, reg_num); Index: lldb/source/Plugins/Process/minidump/MinidumpParser.h =================================================================== --- lldb/source/Plugins/Process/minidump/MinidumpParser.h +++ lldb/source/Plugins/Process/minidump/MinidumpParser.h @@ -54,17 +54,19 @@ llvm::ArrayRef GetData(); - llvm::ArrayRef GetStream(StreamType stream_type); + llvm::ArrayRef GetStream(llvm::minidump::StreamType stream_type); - UUID GetModuleUUID(const minidump::Module *module); + UUID GetModuleUUID(const llvm::minidump::Module *module); - llvm::ArrayRef GetThreads(); + llvm::ArrayRef GetThreads(); - llvm::ArrayRef GetThreadContext(const LocationDescriptor &location); + llvm::ArrayRef + GetThreadContext(const llvm::minidump::LocationDescriptor &location); - llvm::ArrayRef GetThreadContext(const minidump::Thread &td); + llvm::ArrayRef GetThreadContext(const llvm::minidump::Thread &td); - llvm::ArrayRef GetThreadContextWow64(const minidump::Thread &td); + llvm::ArrayRef + GetThreadContextWow64(const llvm::minidump::Thread &td); ArchSpec GetArchitecture(); @@ -74,13 +76,13 @@ llvm::Optional GetPid(); - llvm::ArrayRef GetModuleList(); + llvm::ArrayRef GetModuleList(); // There are cases in which there is more than one record in the ModuleList // for the same module name.(e.g. when the binary has non contiguous segments) // So this function returns a filtered module list - if it finds records that // have the same name, it keeps the copy with the lowest load address. - std::vector GetFilteredModuleList(); + std::vector GetFilteredModuleList(); const llvm::minidump::ExceptionStream *GetExceptionStream(); @@ -92,7 +94,8 @@ /// complete (includes all regions mapped into the process memory). std::pair BuildMemoryRegions(); - static llvm::StringRef GetStreamTypeAsString(StreamType stream_type); + static llvm::StringRef + GetStreamTypeAsString(llvm::minidump::StreamType stream_type); llvm::object::MinidumpFile &GetMinidumpFile() { return *m_file; } Index: lldb/source/Plugins/Process/minidump/MinidumpParser.cpp =================================================================== --- lldb/source/Plugins/Process/minidump/MinidumpParser.cpp +++ lldb/source/Plugins/Process/minidump/MinidumpParser.cpp @@ -44,12 +44,13 @@ m_data_sp->GetByteSize()); } -llvm::ArrayRef MinidumpParser::GetStream(StreamType stream_type) { +llvm::ArrayRef +MinidumpParser::GetStream(llvm::minidump::StreamType stream_type) { return m_file->getRawStream(stream_type) .getValueOr(llvm::ArrayRef()); } -UUID MinidumpParser::GetModuleUUID(const minidump::Module *module) { +UUID MinidumpParser::GetModuleUUID(const llvm::minidump::Module *module) { auto cv_record = GetData().slice(module->CvRecord.RVA, module->CvRecord.DataSize); @@ -80,7 +81,7 @@ return UUID(); } -llvm::ArrayRef MinidumpParser::GetThreads() { +llvm::ArrayRef MinidumpParser::GetThreads() { auto ExpectedThreads = GetMinidumpFile().getThreadList(); if (ExpectedThreads) return *ExpectedThreads; @@ -90,20 +91,20 @@ return {}; } -llvm::ArrayRef -MinidumpParser::GetThreadContext(const LocationDescriptor &location) { +llvm::ArrayRef MinidumpParser::GetThreadContext( + const llvm::minidump::LocationDescriptor &location) { if (location.RVA + location.DataSize > GetData().size()) return {}; return GetData().slice(location.RVA, location.DataSize); } llvm::ArrayRef -MinidumpParser::GetThreadContext(const minidump::Thread &td) { +MinidumpParser::GetThreadContext(const llvm::minidump::Thread &td) { return GetThreadContext(td.Context); } llvm::ArrayRef -MinidumpParser::GetThreadContextWow64(const minidump::Thread &td) { +MinidumpParser::GetThreadContextWow64(const llvm::minidump::Thread &td) { // On Windows, a 32-bit process can run on a 64-bit machine under WOW64. If // the minidump was captured with a 64-bit debugger, then the CONTEXT we just // grabbed from the mini_dump_thread is the one for the 64-bit "native" @@ -134,11 +135,13 @@ } ArchSpec MinidumpParser::GetArchitecture() { + using namespace llvm::minidump; if (m_arch.IsValid()) return m_arch; // Set the architecture in m_arch - llvm::Expected system_info = m_file->getSystemInfo(); + llvm::Expected system_info = + m_file->getSystemInfo(); if (!system_info) { LLDB_LOG_ERROR(GetLog(LLDBLog::Process), system_info.takeError(), @@ -213,7 +216,8 @@ } const MinidumpMiscInfo *MinidumpParser::GetMiscInfo() { - llvm::ArrayRef data = GetStream(StreamType::MiscInfo); + llvm::ArrayRef data = + GetStream(llvm::minidump::StreamType::MiscInfo); if (data.size() == 0) return nullptr; @@ -222,7 +226,8 @@ } llvm::Optional MinidumpParser::GetLinuxProcStatus() { - llvm::ArrayRef data = GetStream(StreamType::LinuxProcStatus); + llvm::ArrayRef data = + GetStream(llvm::minidump::StreamType::LinuxProcStatus); if (data.size() == 0) return llvm::None; @@ -244,7 +249,7 @@ return llvm::None; } -llvm::ArrayRef MinidumpParser::GetModuleList() { +llvm::ArrayRef MinidumpParser::GetModuleList() { auto ExpectedModules = GetMinidumpFile().getModuleList(); if (ExpectedModules) return *ExpectedModules; @@ -257,7 +262,7 @@ static bool CreateRegionsCacheFromLinuxMaps(MinidumpParser &parser, std::vector ®ions) { - auto data = parser.GetStream(StreamType::LinuxMaps); + auto data = parser.GetStream(llvm::minidump::StreamType::LinuxMaps); if (data.empty()) return false; @@ -341,7 +346,8 @@ return false; } -std::vector MinidumpParser::GetFilteredModuleList() { +std::vector +MinidumpParser::GetFilteredModuleList() { Log *log = GetLog(LLDBLog::Modules); auto ExpectedModules = GetMinidumpFile().getModuleList(); if (!ExpectedModules) { @@ -363,7 +369,7 @@ typedef llvm::StringMap MapType; MapType module_name_to_filtered_index; - std::vector filtered_modules; + std::vector filtered_modules; for (const auto &module : *ExpectedModules) { auto ExpectedName = m_file->getString(module.ModuleNameRVA); @@ -417,7 +423,7 @@ return filtered_modules; } -const minidump::ExceptionStream *MinidumpParser::GetExceptionStream() { +const llvm::minidump::ExceptionStream *MinidumpParser::GetExceptionStream() { auto ExpectedStream = GetMinidumpFile().getExceptionStream(); if (ExpectedStream) return &*ExpectedStream; @@ -429,7 +435,8 @@ llvm::Optional MinidumpParser::FindMemoryRange(lldb::addr_t addr) { - llvm::ArrayRef data64 = GetStream(StreamType::Memory64List); + llvm::ArrayRef data64 = + GetStream(llvm::minidump::StreamType::Memory64List); Log *log = GetLog(LLDBLog::Modules); auto ExpectedMemory = GetMinidumpFile().getMemoryList(); @@ -438,7 +445,7 @@ "Failed to read memory list: {0}"); } else { for (const auto &memory_desc : *ExpectedMemory) { - const LocationDescriptor &loc_desc = memory_desc.Memory; + const llvm::minidump::LocationDescriptor &loc_desc = memory_desc.Memory; const lldb::addr_t range_start = memory_desc.StartOfMemoryRange; const size_t range_size = loc_desc.DataSize; @@ -524,26 +531,30 @@ } constexpr auto yes = MemoryRegionInfo::eYes; constexpr auto no = MemoryRegionInfo::eNo; - for (const MemoryInfo &entry : *ExpectedInfo) { + for (const llvm::minidump::MemoryInfo &entry : *ExpectedInfo) { MemoryRegionInfo region; region.GetRange().SetRangeBase(entry.BaseAddress); region.GetRange().SetByteSize(entry.RegionSize); - MemoryProtection prot = entry.Protect; - region.SetReadable(bool(prot & MemoryProtection::NoAccess) ? no : yes); + llvm::minidump::MemoryProtection prot = entry.Protect; + region.SetReadable( + bool(prot & llvm::minidump::MemoryProtection::NoAccess) ? no : yes); region.SetWritable( - bool(prot & (MemoryProtection::ReadWrite | MemoryProtection::WriteCopy | - MemoryProtection::ExecuteReadWrite | - MemoryProtection::ExeciteWriteCopy)) + bool(prot & (llvm::minidump::MemoryProtection::ReadWrite | + llvm::minidump::MemoryProtection::WriteCopy | + llvm::minidump::MemoryProtection::ExecuteReadWrite | + llvm::minidump::MemoryProtection::ExeciteWriteCopy)) ? yes : no); region.SetExecutable( - bool(prot & (MemoryProtection::Execute | MemoryProtection::ExecuteRead | - MemoryProtection::ExecuteReadWrite | - MemoryProtection::ExeciteWriteCopy)) + bool(prot & (llvm::minidump::MemoryProtection::Execute | + llvm::minidump::MemoryProtection::ExecuteRead | + llvm::minidump::MemoryProtection::ExecuteReadWrite | + llvm::minidump::MemoryProtection::ExeciteWriteCopy)) ? yes : no); - region.SetMapped(entry.State != MemoryState::Free ? yes : no); + region.SetMapped(entry.State != llvm::minidump::MemoryState::Free ? yes + : no); regions.push_back(region); } return !regions.empty(); @@ -560,7 +571,7 @@ return false; } regions.reserve(ExpectedMemory->size()); - for (const MemoryDescriptor &memory_desc : *ExpectedMemory) { + for (const llvm::minidump::MemoryDescriptor &memory_desc : *ExpectedMemory) { if (memory_desc.Memory.DataSize == 0) continue; MemoryRegionInfo region; @@ -578,7 +589,7 @@ CreateRegionsCacheFromMemory64List(MinidumpParser &parser, std::vector ®ions) { llvm::ArrayRef data = - parser.GetStream(StreamType::Memory64List); + parser.GetStream(llvm::minidump::StreamType::Memory64List); if (data.empty()) return false; llvm::ArrayRef memory64_list; @@ -627,11 +638,12 @@ } #define ENUM_TO_CSTR(ST) \ - case StreamType::ST: \ + case llvm::minidump::StreamType::ST: \ return #ST llvm::StringRef -MinidumpParser::GetStreamTypeAsString(StreamType stream_type) { +MinidumpParser::GetStreamTypeAsString(llvm::minidump::StreamType stream_type) { + using namespace llvm::minidump; switch (stream_type) { ENUM_TO_CSTR(Unused); ENUM_TO_CSTR(ThreadList); Index: lldb/source/Plugins/Process/minidump/MinidumpTypes.h =================================================================== --- lldb/source/Plugins/Process/minidump/MinidumpTypes.h +++ lldb/source/Plugins/Process/minidump/MinidumpTypes.h @@ -31,8 +31,6 @@ namespace minidump { -using namespace llvm::minidump; - LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); enum class CvSignature : uint32_t { Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.h =================================================================== --- lldb/source/Plugins/Process/minidump/ProcessMinidump.h +++ lldb/source/Plugins/Process/minidump/ProcessMinidump.h @@ -109,8 +109,8 @@ private: FileSpec m_core_file; lldb::DataBufferSP m_core_data; - llvm::ArrayRef m_thread_list; - const minidump::ExceptionStream *m_active_exception; + llvm::ArrayRef m_thread_list; + const llvm::minidump::ExceptionStream *m_active_exception; lldb::CommandObjectSP m_command_sp; bool m_is_wow64; llvm::Optional m_memory_regions; Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp =================================================================== --- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -204,7 +204,7 @@ lldb::ProcessSP process_sp; // Read enough data for the Minidump header - constexpr size_t header_size = sizeof(Header); + constexpr size_t header_size = sizeof(llvm::minidump::Header); auto DataPtr = FileSystem::Instance().CreateDataBuffer(crash_file->GetPath(), header_size, 0); if (!DataPtr) @@ -457,8 +457,8 @@ bool ProcessMinidump::DoUpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) { - for (const minidump::Thread &thread : m_thread_list) { - LocationDescriptor context_location = thread.Context; + for (const llvm::minidump::Thread &thread : m_thread_list) { + llvm::minidump::LocationDescriptor context_location = thread.Context; // If the minidump contains an exception context, use it if (m_active_exception != nullptr && @@ -526,7 +526,7 @@ } void ProcessMinidump::ReadModuleList() { - std::vector filtered_modules = + std::vector filtered_modules = m_minidump_parser->GetFilteredModuleList(); Log *log = GetLog(LLDBLog::DynamicLoader); @@ -890,11 +890,11 @@ s.Printf( "0x%8.8x 0x%8.8x 0x%8.8x %s\n", (uint32_t)stream_desc.Location.RVA, (uint32_t)stream_desc.Location.DataSize, - (unsigned)(StreamType)stream_desc.Type, + (unsigned)(llvm::minidump::StreamType)stream_desc.Type, MinidumpParser::GetStreamTypeAsString(stream_desc.Type).data()); s.Printf("\n"); } - auto DumpTextStream = [&](StreamType stream_type, + auto DumpTextStream = [&](llvm::minidump::StreamType stream_type, llvm::StringRef label) -> void { auto bytes = minidump.GetStream(stream_type); if (!bytes.empty()) { @@ -903,7 +903,7 @@ s.Printf("%s:\n%s\n\n", label.data(), bytes.data()); } }; - auto DumpBinaryStream = [&](StreamType stream_type, + auto DumpBinaryStream = [&](llvm::minidump::StreamType stream_type, llvm::StringRef label) -> void { auto bytes = minidump.GetStream(stream_type); if (!bytes.empty()) { @@ -919,30 +919,36 @@ }; if (DumpLinuxCPUInfo()) - DumpTextStream(StreamType::LinuxCPUInfo, "/proc/cpuinfo"); + DumpTextStream(llvm::minidump::StreamType::LinuxCPUInfo, "/proc/cpuinfo"); if (DumpLinuxProcStatus()) - DumpTextStream(StreamType::LinuxProcStatus, "/proc/PID/status"); + DumpTextStream(llvm::minidump::StreamType::LinuxProcStatus, + "/proc/PID/status"); if (DumpLinuxLSBRelease()) - DumpTextStream(StreamType::LinuxLSBRelease, "/etc/lsb-release"); + DumpTextStream(llvm::minidump::StreamType::LinuxLSBRelease, + "/etc/lsb-release"); if (DumpLinuxCMDLine()) - DumpTextStream(StreamType::LinuxCMDLine, "/proc/PID/cmdline"); + DumpTextStream(llvm::minidump::StreamType::LinuxCMDLine, + "/proc/PID/cmdline"); if (DumpLinuxEnviron()) - DumpTextStream(StreamType::LinuxEnviron, "/proc/PID/environ"); + DumpTextStream(llvm::minidump::StreamType::LinuxEnviron, + "/proc/PID/environ"); if (DumpLinuxAuxv()) - DumpBinaryStream(StreamType::LinuxAuxv, "/proc/PID/auxv"); + DumpBinaryStream(llvm::minidump::StreamType::LinuxAuxv, "/proc/PID/auxv"); if (DumpLinuxMaps()) - DumpTextStream(StreamType::LinuxMaps, "/proc/PID/maps"); + DumpTextStream(llvm::minidump::StreamType::LinuxMaps, "/proc/PID/maps"); if (DumpLinuxProcStat()) - DumpTextStream(StreamType::LinuxProcStat, "/proc/PID/stat"); + DumpTextStream(llvm::minidump::StreamType::LinuxProcStat, + "/proc/PID/stat"); if (DumpLinuxProcUptime()) - DumpTextStream(StreamType::LinuxProcUptime, "uptime"); + DumpTextStream(llvm::minidump::StreamType::LinuxProcUptime, "uptime"); if (DumpLinuxProcFD()) - DumpTextStream(StreamType::LinuxProcFD, "/proc/PID/fd"); + DumpTextStream(llvm::minidump::StreamType::LinuxProcFD, "/proc/PID/fd"); if (DumpFacebookAppData()) - DumpTextStream(StreamType::FacebookAppCustomData, + DumpTextStream(llvm::minidump::StreamType::FacebookAppCustomData, "Facebook App Data"); if (DumpFacebookBuildID()) { - auto bytes = minidump.GetStream(StreamType::FacebookBuildID); + auto bytes = + minidump.GetStream(llvm::minidump::StreamType::FacebookBuildID); if (bytes.size() >= 4) { DataExtractor data(bytes.data(), bytes.size(), eByteOrderLittle, process->GetAddressByteSize()); @@ -954,31 +960,31 @@ } } if (DumpFacebookVersionName()) - DumpTextStream(StreamType::FacebookAppVersionName, + DumpTextStream(llvm::minidump::StreamType::FacebookAppVersionName, "Facebook Version String"); if (DumpFacebookJavaStack()) - DumpTextStream(StreamType::FacebookJavaStack, + DumpTextStream(llvm::minidump::StreamType::FacebookJavaStack, "Facebook Java Stack"); if (DumpFacebookDalvikInfo()) - DumpTextStream(StreamType::FacebookDalvikInfo, + DumpTextStream(llvm::minidump::StreamType::FacebookDalvikInfo, "Facebook Dalvik Info"); if (DumpFacebookUnwindSymbols()) - DumpBinaryStream(StreamType::FacebookUnwindSymbols, + DumpBinaryStream(llvm::minidump::StreamType::FacebookUnwindSymbols, "Facebook Unwind Symbols Bytes"); if (DumpFacebookErrorLog()) - DumpTextStream(StreamType::FacebookDumpErrorLog, + DumpTextStream(llvm::minidump::StreamType::FacebookDumpErrorLog, "Facebook Error Log"); if (DumpFacebookAppStateLog()) - DumpTextStream(StreamType::FacebookAppStateLog, + DumpTextStream(llvm::minidump::StreamType::FacebookAppStateLog, "Faceook Application State Log"); if (DumpFacebookAbortReason()) - DumpTextStream(StreamType::FacebookAbortReason, + DumpTextStream(llvm::minidump::StreamType::FacebookAbortReason, "Facebook Abort Reason"); if (DumpFacebookThreadName()) - DumpTextStream(StreamType::FacebookThreadName, + DumpTextStream(llvm::minidump::StreamType::FacebookThreadName, "Facebook Thread Name"); if (DumpFacebookLogcat()) - DumpTextStream(StreamType::FacebookLogcat, + DumpTextStream(llvm::minidump::StreamType::FacebookLogcat, "Facebook Logcat"); return true; } Index: lldb/source/Plugins/Process/minidump/ThreadMinidump.h =================================================================== --- lldb/source/Plugins/Process/minidump/ThreadMinidump.h +++ lldb/source/Plugins/Process/minidump/ThreadMinidump.h @@ -20,7 +20,7 @@ class ThreadMinidump : public Thread { public: - ThreadMinidump(Process &process, const minidump::Thread &td, + ThreadMinidump(Process &process, const llvm::minidump::Thread &td, llvm::ArrayRef gpregset_data); ~ThreadMinidump() override; Index: lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp =================================================================== --- lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp +++ lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp @@ -33,7 +33,8 @@ using namespace lldb_private; using namespace minidump; -ThreadMinidump::ThreadMinidump(Process &process, const minidump::Thread &td, +ThreadMinidump::ThreadMinidump(Process &process, + const llvm::minidump::Thread &td, llvm::ArrayRef gpregset_data) : Thread(process, td.ThreadId), m_thread_reg_ctx_sp(), m_gpregset_data(gpregset_data) {} Index: lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp @@ -150,8 +150,8 @@ // first we can avoid extracting type DIEs from object files that // would fail the filter anyway. if (!has_qualified_name_hash && (context.GetSize() > 1) && - (context[1].tag == DW_TAG_class_type || - context[1].tag == DW_TAG_structure_type)) { + (context[1].tag == llvm::dwarf::DW_TAG_class_type || + context[1].tag == llvm::dwarf::DW_TAG_structure_type)) { if (m_apple_types_up->FindByName(context[1].name, [&](DIERef ref) { return false; })) return; Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -64,11 +64,11 @@ static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) { switch (dwarf_accessibility) { - case DW_ACCESS_public: + case llvm::dwarf::DW_ACCESS_public: return eAccessPublic; - case DW_ACCESS_private: + case llvm::dwarf::DW_ACCESS_private: return eAccessPrivate; - case DW_ACCESS_protected: + case llvm::dwarf::DW_ACCESS_protected: return eAccessProtected; default: break; @@ -97,11 +97,11 @@ /// Detect a forward declaration that is nested in a DW_TAG_module. static bool IsClangModuleFwdDecl(const DWARFDIE &Die) { - if (!Die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) + if (!Die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_declaration, 0)) return false; auto Parent = Die.GetParent(); while (Parent.IsValid()) { - if (Parent.Tag() == DW_TAG_module) + if (Parent.Tag() == llvm::dwarf::DW_TAG_module) return true; Parent = Parent.GetParent(); } @@ -116,9 +116,10 @@ for (DWARFDIE parent = die.GetParent(); parent.IsValid(); parent = parent.GetParent()) { const dw_tag_t tag = parent.Tag(); - if (tag == DW_TAG_module) + if (tag == llvm::dwarf::DW_TAG_module) top_module_die = parent; - else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit) + else if (tag == llvm::dwarf::DW_TAG_compile_unit || + tag == llvm::dwarf::DW_TAG_partial_unit) break; } @@ -308,120 +309,120 @@ if (!attributes.ExtractFormValueAtIndex(i, form_value)) continue; switch (attr) { - case DW_AT_abstract_origin: + case llvm::dwarf::DW_AT_abstract_origin: abstract_origin = form_value; break; - case DW_AT_accessibility: + case llvm::dwarf::DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_artificial: + case llvm::dwarf::DW_AT_artificial: is_artificial = form_value.Boolean(); break; - case DW_AT_bit_stride: + case llvm::dwarf::DW_AT_bit_stride: bit_stride = form_value.Unsigned(); break; - case DW_AT_byte_size: + case llvm::dwarf::DW_AT_byte_size: byte_size = form_value.Unsigned(); break; - case DW_AT_byte_stride: + case llvm::dwarf::DW_AT_byte_stride: byte_stride = form_value.Unsigned(); break; - case DW_AT_calling_convention: + case llvm::dwarf::DW_AT_calling_convention: calling_convention = form_value.Unsigned(); break; - case DW_AT_containing_type: + case llvm::dwarf::DW_AT_containing_type: containing_type = form_value; break; - case DW_AT_decl_file: + case llvm::dwarf::DW_AT_decl_file: // die.GetCU() can differ if DW_AT_specification uses DW_FORM_ref_addr. decl.SetFile( attributes.CompileUnitAtIndex(i)->GetFile(form_value.Unsigned())); break; - case DW_AT_decl_line: + case llvm::dwarf::DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; - case DW_AT_decl_column: + case llvm::dwarf::DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; - case DW_AT_declaration: + case llvm::dwarf::DW_AT_declaration: is_forward_declaration = form_value.Boolean(); break; - case DW_AT_encoding: + case llvm::dwarf::DW_AT_encoding: encoding = form_value.Unsigned(); break; - case DW_AT_enum_class: + case llvm::dwarf::DW_AT_enum_class: is_scoped_enum = form_value.Boolean(); break; - case DW_AT_explicit: + case llvm::dwarf::DW_AT_explicit: is_explicit = form_value.Boolean(); break; - case DW_AT_external: + case llvm::dwarf::DW_AT_external: if (form_value.Unsigned()) storage = clang::SC_Extern; break; - case DW_AT_inline: + case llvm::dwarf::DW_AT_inline: is_inline = form_value.Boolean(); break; - case DW_AT_linkage_name: - case DW_AT_MIPS_linkage_name: + case llvm::dwarf::DW_AT_linkage_name: + case llvm::dwarf::DW_AT_MIPS_linkage_name: mangled_name = form_value.AsCString(); break; - case DW_AT_name: + case llvm::dwarf::DW_AT_name: name.SetCString(form_value.AsCString()); break; - case DW_AT_object_pointer: + case llvm::dwarf::DW_AT_object_pointer: object_pointer = form_value.Reference(); break; - case DW_AT_signature: + case llvm::dwarf::DW_AT_signature: signature = form_value; break; - case DW_AT_specification: + case llvm::dwarf::DW_AT_specification: specification = form_value; break; - case DW_AT_type: + case llvm::dwarf::DW_AT_type: type = form_value; break; - case DW_AT_virtuality: + case llvm::dwarf::DW_AT_virtuality: is_virtual = form_value.Boolean(); break; - case DW_AT_APPLE_objc_complete_type: + case llvm::dwarf::DW_AT_APPLE_objc_complete_type: is_complete_objc_class = form_value.Signed(); break; - case DW_AT_APPLE_objc_direct: + case llvm::dwarf::DW_AT_APPLE_objc_direct: is_objc_direct_call = true; break; - case DW_AT_APPLE_runtime_class: + case llvm::dwarf::DW_AT_APPLE_runtime_class: class_language = (LanguageType)form_value.Signed(); break; - case DW_AT_GNU_vector: + case llvm::dwarf::DW_AT_GNU_vector: is_vector = form_value.Boolean(); break; - case DW_AT_export_symbols: + case llvm::dwarf::DW_AT_export_symbols: exports_symbols = form_value.Boolean(); break; } @@ -489,43 +490,43 @@ TypeSP type_sp; switch (tag) { - case DW_TAG_typedef: - case DW_TAG_base_type: - case DW_TAG_pointer_type: - case DW_TAG_reference_type: - case DW_TAG_rvalue_reference_type: - case DW_TAG_const_type: - case DW_TAG_restrict_type: - case DW_TAG_volatile_type: - case DW_TAG_atomic_type: - case DW_TAG_unspecified_type: { + case llvm::dwarf::DW_TAG_typedef: + case llvm::dwarf::DW_TAG_base_type: + case llvm::dwarf::DW_TAG_pointer_type: + case llvm::dwarf::DW_TAG_reference_type: + case llvm::dwarf::DW_TAG_rvalue_reference_type: + case llvm::dwarf::DW_TAG_const_type: + case llvm::dwarf::DW_TAG_restrict_type: + case llvm::dwarf::DW_TAG_volatile_type: + case llvm::dwarf::DW_TAG_atomic_type: + case llvm::dwarf::DW_TAG_unspecified_type: { type_sp = ParseTypeModifier(sc, die, attrs); break; } - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_class_type: { + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_union_type: + case llvm::dwarf::DW_TAG_class_type: { type_sp = ParseStructureLikeDIE(sc, die, attrs); break; } - case DW_TAG_enumeration_type: { + case llvm::dwarf::DW_TAG_enumeration_type: { type_sp = ParseEnum(sc, die, attrs); break; } - case DW_TAG_inlined_subroutine: - case DW_TAG_subprogram: - case DW_TAG_subroutine_type: { + case llvm::dwarf::DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_subroutine_type: { type_sp = ParseSubroutine(die, attrs); break; } - case DW_TAG_array_type: { + case llvm::dwarf::DW_TAG_array_type: { type_sp = ParseArrayType(die, attrs); break; } - case DW_TAG_ptr_to_member_type: { + case llvm::dwarf::DW_TAG_ptr_to_member_type: { type_sp = ParsePointerToMemberType(die, attrs); break; } @@ -556,7 +557,7 @@ TypeSP type_sp; CompilerType clang_type; - if (tag == DW_TAG_typedef) { + if (tag == llvm::dwarf::DW_TAG_typedef) { // DeclContext will be populated when the clang type is materialized in // Type::ResolveCompilerType. PrepareContextToReceiveMembers( @@ -595,8 +596,8 @@ // definition since template types can't be represented in // modules since only concrete instances of templates are ever // emitted and modules won't contain those - if (encoding_die && - encoding_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 1) { + if (encoding_die && encoding_die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_declaration, 0) == 1) { type_sp = ParseTypeFromClangModule(sc, die, log); if (type_sp) return type_sp; @@ -612,7 +613,7 @@ default: break; - case DW_TAG_unspecified_type: + case llvm::dwarf::DW_TAG_unspecified_type: if (attrs.name == "nullptr_t" || attrs.name == "decltype(nullptr)") { resolve_state = Type::ResolveState::Full; clang_type = m_ast.GetBasicType(eBasicTypeNullPtr); @@ -622,57 +623,59 @@ // there... LLVM_FALLTHROUGH; - case DW_TAG_base_type: + case llvm::dwarf::DW_TAG_base_type: resolve_state = Type::ResolveState::Full; clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize( attrs.name.GetStringRef(), attrs.encoding, attrs.byte_size.getValueOr(0) * 8); break; - case DW_TAG_pointer_type: + case llvm::dwarf::DW_TAG_pointer_type: encoding_data_type = Type::eEncodingIsPointerUID; break; - case DW_TAG_reference_type: + case llvm::dwarf::DW_TAG_reference_type: encoding_data_type = Type::eEncodingIsLValueReferenceUID; break; - case DW_TAG_rvalue_reference_type: + case llvm::dwarf::DW_TAG_rvalue_reference_type: encoding_data_type = Type::eEncodingIsRValueReferenceUID; break; - case DW_TAG_typedef: + case llvm::dwarf::DW_TAG_typedef: encoding_data_type = Type::eEncodingIsTypedefUID; break; - case DW_TAG_const_type: + case llvm::dwarf::DW_TAG_const_type: encoding_data_type = Type::eEncodingIsConstUID; break; - case DW_TAG_restrict_type: + case llvm::dwarf::DW_TAG_restrict_type: encoding_data_type = Type::eEncodingIsRestrictUID; break; - case DW_TAG_volatile_type: + case llvm::dwarf::DW_TAG_volatile_type: encoding_data_type = Type::eEncodingIsVolatileUID; break; - case DW_TAG_atomic_type: + case llvm::dwarf::DW_TAG_atomic_type: encoding_data_type = Type::eEncodingIsAtomicUID; break; } if (!clang_type && (encoding_data_type == Type::eEncodingIsPointerUID || encoding_data_type == Type::eEncodingIsTypedefUID)) { - if (tag == DW_TAG_pointer_type) { - DWARFDIE target_die = die.GetReferencedDIE(DW_AT_type); + if (tag == llvm::dwarf::DW_TAG_pointer_type) { + DWARFDIE target_die = die.GetReferencedDIE(llvm::dwarf::DW_AT_type); - if (target_die.GetAttributeValueAsUnsigned(DW_AT_APPLE_block, 0)) { + if (target_die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_APPLE_block, + 0)) { // Blocks have a __FuncPtr inside them which is a pointer to a // function of the proper type. for (DWARFDIE child_die : target_die.children()) { - if (!strcmp(child_die.GetAttributeValueAsString(DW_AT_name, ""), + if (!strcmp(child_die.GetAttributeValueAsString( + llvm::dwarf::DW_AT_name, ""), "__FuncPtr")) { DWARFDIE function_pointer_type = - child_die.GetReferencedDIE(DW_AT_type); + child_die.GetReferencedDIE(llvm::dwarf::DW_AT_type); if (function_pointer_type) { - DWARFDIE function_type = - function_pointer_type.GetReferencedDIE(DW_AT_type); + DWARFDIE function_type = function_pointer_type.GetReferencedDIE( + llvm::dwarf::DW_AT_type); bool function_type_is_new_pointer; TypeSP lldb_function_type_sp = ParseTypeFromDWARF( @@ -737,7 +740,8 @@ const DWARFDIE encoding_die = attrs.type.Reference(); - if (encoding_die && encoding_die.Tag() == DW_TAG_structure_type) { + if (encoding_die && + encoding_die.Tag() == llvm::dwarf::DW_TAG_structure_type) { llvm::StringRef struct_name = encoding_die.GetName(); if (struct_name == "objc_object") { if (log) @@ -833,7 +837,7 @@ if (!enumerator_clang_type) { if (attrs.byte_size) { enumerator_clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize( - "", DW_ATE_signed, *attrs.byte_size * 8); + "", llvm::dwarf::DW_ATE_signed, *attrs.byte_size * 8); } else { enumerator_clang_type = m_ast.GetBasicType(eBasicTypeInt); } @@ -992,7 +996,8 @@ if (attrs.name) { bool type_handled = false; - if (tag == DW_TAG_subprogram || tag == DW_TAG_inlined_subroutine) { + if (tag == llvm::dwarf::DW_TAG_subprogram || + tag == llvm::dwarf::DW_TAG_inlined_subroutine) { ObjCLanguage::MethodName objc_method(attrs.name.GetStringRef(), true); if (objc_method.IsValid(true)) { CompilerType class_opaque_type; @@ -1431,10 +1436,10 @@ DWARFFormValue form_value; if (attributes.ExtractFormValueAtIndex(i, form_value)) { switch (attr) { - case DW_AT_type: + case llvm::dwarf::DW_AT_type: encoding_form = form_value; break; - case DW_AT_data_member_location: + case llvm::dwarf::DW_AT_data_member_location: if (form_value.BlockData()) { Value initialValue(0); Value memberOffset(0); @@ -1457,11 +1462,11 @@ } break; - case DW_AT_accessibility: + case llvm::dwarf::DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_virtuality: + case llvm::dwarf::DW_AT_virtuality: is_virtual = form_value.Boolean(); break; @@ -1529,8 +1534,8 @@ dw_tag_t sc_parent_tag = sc_parent_die.Tag(); SymbolContextScope *symbol_context_scope = nullptr; - if (sc_parent_tag == DW_TAG_compile_unit || - sc_parent_tag == DW_TAG_partial_unit) { + if (sc_parent_tag == llvm::dwarf::DW_TAG_compile_unit || + sc_parent_tag == llvm::dwarf::DW_TAG_partial_unit) { symbol_context_scope = sc.comp_unit; } else if (sc.function != nullptr && sc_parent_die) { symbol_context_scope = @@ -1597,13 +1602,13 @@ int tag_decl_kind = -1; AccessType default_accessibility = eAccessNone; - if (tag == DW_TAG_structure_type) { + if (tag == llvm::dwarf::DW_TAG_structure_type) { tag_decl_kind = clang::TTK_Struct; default_accessibility = eAccessPublic; - } else if (tag == DW_TAG_union_type) { + } else if (tag == llvm::dwarf::DW_TAG_union_type) { tag_decl_kind = clang::TTK_Union; default_accessibility = eAccessPublic; - } else if (tag == DW_TAG_class_type) { + } else if (tag == llvm::dwarf::DW_TAG_class_type) { tag_decl_kind = clang::TTK_Class; default_accessibility = eAccessPrivate; } @@ -1962,7 +1967,7 @@ bool is_template_template_argument = false; switch (tag) { - case DW_TAG_GNU_template_parameter_pack: { + case llvm::dwarf::DW_TAG_GNU_template_parameter_pack: { template_param_infos.packed_args = std::make_unique(); for (DWARFDIE child_die : die.children()) { @@ -1974,11 +1979,11 @@ } return true; } - case DW_TAG_GNU_template_template_param: + case llvm::dwarf::DW_TAG_GNU_template_template_param: is_template_template_argument = true; LLVM_FALLTHROUGH; - case DW_TAG_template_type_parameter: - case DW_TAG_template_value_parameter: { + case llvm::dwarf::DW_TAG_template_type_parameter: + case llvm::dwarf::DW_TAG_template_value_parameter: { DWARFAttributes attributes; const size_t num_attributes = die.GetAttributes(attributes); const char *name = nullptr; @@ -1992,17 +1997,17 @@ const dw_attr_t attr = attributes.AttributeAtIndex(i); switch (attr) { - case DW_AT_name: + case llvm::dwarf::DW_AT_name: if (attributes.ExtractFormValueAtIndex(i, form_value)) name = form_value.AsCString(); break; - case DW_AT_GNU_template_name: + case llvm::dwarf::DW_AT_GNU_template_name: if (attributes.ExtractFormValueAtIndex(i, form_value)) template_name = form_value.AsCString(); break; - case DW_AT_type: + case llvm::dwarf::DW_AT_type: if (attributes.ExtractFormValueAtIndex(i, form_value)) { Type *lldb_type = die.ResolveTypeUID(form_value.Reference()); if (lldb_type) @@ -2010,7 +2015,7 @@ } break; - case DW_AT_const_value: + case llvm::dwarf::DW_AT_const_value: if (attributes.ExtractFormValueAtIndex(i, form_value)) { uval64_valid = true; uval64 = form_value.Unsigned(); @@ -2035,7 +2040,8 @@ // Get the signed value for any integer or enumeration if available clang_type.IsIntegerOrEnumerationType(is_signed); - if (tag == DW_TAG_template_value_parameter && uval64_valid) { + if (tag == llvm::dwarf::DW_TAG_template_value_parameter && + uval64_valid) { llvm::Optional size = clang_type.GetBitSize(nullptr); if (!size) return false; @@ -2074,10 +2080,10 @@ const dw_tag_t tag = die.Tag(); switch (tag) { - case DW_TAG_template_type_parameter: - case DW_TAG_template_value_parameter: - case DW_TAG_GNU_template_parameter_pack: - case DW_TAG_GNU_template_template_param: + case llvm::dwarf::DW_TAG_template_type_parameter: + case llvm::dwarf::DW_TAG_template_value_parameter: + case llvm::dwarf::DW_TAG_GNU_template_parameter_pack: + case llvm::dwarf::DW_TAG_GNU_template_template_param: ParseTemplateDIE(die, template_param_infos); break; @@ -2106,11 +2112,11 @@ } AccessType default_accessibility = eAccessNone; - if (tag == DW_TAG_structure_type) { + if (tag == llvm::dwarf::DW_TAG_structure_type) { default_accessibility = eAccessPublic; - } else if (tag == DW_TAG_union_type) { + } else if (tag == llvm::dwarf::DW_TAG_union_type) { default_accessibility = eAccessPublic; - } else if (tag == DW_TAG_class_type) { + } else if (tag == llvm::dwarf::DW_TAG_class_type) { default_accessibility = eAccessPrivate; } @@ -2165,7 +2171,7 @@ layout_info.bit_size = type->GetByteSize(nullptr).getValueOr(0) * 8; if (layout_info.bit_size == 0) layout_info.bit_size = - die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8; + die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_byte_size, 0) * 8; clang::CXXRecordDecl *record_decl = m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType()); @@ -2211,11 +2217,11 @@ assert(clang_type); DWARFAttributes attributes; switch (tag) { - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_class_type: + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_union_type: + case llvm::dwarf::DW_TAG_class_type: return CompleteRecordType(die, type, clang_type); - case DW_TAG_enumeration_type: + case llvm::dwarf::DW_TAG_enumeration_type: return CompleteEnumType(die, type, clang_type); default: assert(false && "not a forward clang type decl!"); @@ -2270,7 +2276,7 @@ for (DWARFDIE die : parent_die.children()) { const dw_tag_t tag = die.Tag(); - if (tag == DW_TAG_enumerator) { + if (tag == llvm::dwarf::DW_TAG_enumerator) { DWARFAttributes attributes; const size_t num_child_attributes = die.GetAttributes(attributes); if (num_child_attributes > 0) { @@ -2285,7 +2291,7 @@ DWARFFormValue form_value; if (attributes.ExtractFormValueAtIndex(i, form_value)) { switch (attr) { - case DW_AT_const_value: + case llvm::dwarf::DW_AT_const_value: got_value = true; if (is_signed) enum_value = form_value.Signed(); @@ -2293,23 +2299,23 @@ enum_value = form_value.Unsigned(); break; - case DW_AT_name: + case llvm::dwarf::DW_AT_name: name = form_value.AsCString(); break; - case DW_AT_description: + case llvm::dwarf::DW_AT_description: default: - case DW_AT_decl_file: + case llvm::dwarf::DW_AT_decl_file: decl.SetFile(attributes.CompileUnitAtIndex(i)->GetFile( form_value.Unsigned())); break; - case DW_AT_decl_line: + case llvm::dwarf::DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; - case DW_AT_decl_column: + case llvm::dwarf::DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; - case DW_AT_sibling: + case llvm::dwarf::DW_AT_sibling: break; } } @@ -2344,7 +2350,7 @@ const dw_tag_t tag = die.Tag(); - if (tag != DW_TAG_subprogram) + if (tag != llvm::dwarf::DW_TAG_subprogram) return nullptr; if (die.GetDIENamesAndRanges(name, mangled, func_ranges, decl_file, decl_line, @@ -2353,8 +2359,8 @@ Mangled func_name; if (mangled) func_name.SetValue(ConstString(mangled), true); - else if ((die.GetParent().Tag() == DW_TAG_compile_unit || - die.GetParent().Tag() == DW_TAG_partial_unit) && + else if ((die.GetParent().Tag() == llvm::dwarf::DW_TAG_compile_unit || + die.GetParent().Tag() == llvm::dwarf::DW_TAG_partial_unit) && Language::LanguageIsCPlusPlus( SymbolFileDWARF::GetLanguage(*die.GetCU())) && !Language::LanguageIsObjC( @@ -2462,7 +2468,8 @@ MemberAttributes::MemberAttributes(const DWARFDIE &die, const DWARFDIE &parent_die, ModuleSP module_sp) { - member_byte_offset = (parent_die.Tag() == DW_TAG_union_type) ? 0 : UINT32_MAX; + member_byte_offset = + (parent_die.Tag() == llvm::dwarf::DW_TAG_union_type) ? 0 : UINT32_MAX; DWARFAttributes attributes; const size_t num_attributes = die.GetAttributes(attributes); @@ -2471,25 +2478,25 @@ DWARFFormValue form_value; if (attributes.ExtractFormValueAtIndex(i, form_value)) { switch (attr) { - case DW_AT_name: + case llvm::dwarf::DW_AT_name: name = form_value.AsCString(); break; - case DW_AT_type: + case llvm::dwarf::DW_AT_type: encoding_form = form_value; break; - case DW_AT_bit_offset: + case llvm::dwarf::DW_AT_bit_offset: bit_offset = form_value.Signed(); break; - case DW_AT_bit_size: + case llvm::dwarf::DW_AT_bit_size: bit_size = form_value.Unsigned(); break; - case DW_AT_byte_size: + case llvm::dwarf::DW_AT_byte_size: byte_size = form_value.Unsigned(); break; - case DW_AT_data_bit_offset: + case llvm::dwarf::DW_AT_data_bit_offset: data_bit_offset = form_value.Unsigned(); break; - case DW_AT_data_member_location: + case llvm::dwarf::DW_AT_data_member_location: if (form_value.BlockData()) { Value initialValue(0); Value memberOffset(0); @@ -2514,13 +2521,13 @@ } break; - case DW_AT_accessibility: + case llvm::dwarf::DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_artificial: + case llvm::dwarf::DW_AT_artificial: is_artificial = form_value.Boolean(); break; - case DW_AT_external: + case llvm::dwarf::DW_AT_external: is_external = form_value.Boolean(); break; default: @@ -2556,16 +2563,16 @@ DWARFFormValue form_value; if (attributes.ExtractFormValueAtIndex(i, form_value)) { switch (attr) { - case DW_AT_APPLE_property_name: + case llvm::dwarf::DW_AT_APPLE_property_name: prop_name = form_value.AsCString(); break; - case DW_AT_APPLE_property_getter: + case llvm::dwarf::DW_AT_APPLE_property_getter: prop_getter_name = form_value.AsCString(); break; - case DW_AT_APPLE_property_setter: + case llvm::dwarf::DW_AT_APPLE_property_setter: prop_setter_name = form_value.AsCString(); break; - case DW_AT_APPLE_property_attribute: + case llvm::dwarf::DW_AT_APPLE_property_attribute: prop_attributes = form_value.Unsigned(); break; default: @@ -2594,7 +2601,7 @@ if (!prop_getter_name) prop_getter_name = prop_name; if (!prop_setter_name && prop_name[0] && - !(prop_attributes & DW_APPLE_PROPERTY_readonly)) { + !(prop_attributes & llvm::dwarf::DW_APPLE_PROPERTY_readonly)) { StreamString ss; ss.Printf("set%c%s:", toupper(prop_name[0]), &prop_name[1]); @@ -2609,7 +2616,7 @@ const lldb_private::CompilerType &class_clang_type, DelayedPropertyList &delayed_properties) { // This function can only parse DW_TAG_APPLE_property. - assert(die.Tag() == DW_TAG_APPLE_property); + assert(die.Tag() == llvm::dwarf::DW_TAG_APPLE_property); ModuleSP module_sp = parent_die.GetDWARF()->GetObjectFile()->GetModule(); @@ -2647,13 +2654,13 @@ lldb_private::ClangASTImporter::LayoutInfo &layout_info, FieldInfo &last_field_info) { // This function can only parse DW_TAG_member. - assert(die.Tag() == DW_TAG_member); + assert(die.Tag() == llvm::dwarf::DW_TAG_member); ModuleSP module_sp = parent_die.GetDWARF()->GetObjectFile()->GetModule(); const dw_tag_t tag = die.Tag(); // Get the parent byte size so we can verify any members will fit - const uint64_t parent_byte_size = - parent_die.GetAttributeValueAsUnsigned(DW_AT_byte_size, UINT64_MAX); + const uint64_t parent_byte_size = parent_die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_byte_size, UINT64_MAX); const uint64_t parent_bit_size = parent_byte_size == UINT64_MAX ? UINT64_MAX : parent_byte_size * 8; @@ -2734,7 +2741,7 @@ // We also skip this for fields of a union since they will all have a // zero offset. if (!TypeSystemClang::IsObjCObjectOrInterfaceType(class_clang_type) && - !(parent_die.Tag() == DW_TAG_union_type && + !(parent_die.Tag() == llvm::dwarf::DW_TAG_union_type && this_field_info.bit_offset == 0) && ((this_field_info.bit_offset >= parent_bit_size) || (last_field_info.IsBitfield() && @@ -2853,8 +2860,8 @@ &member_array_size, &member_array_is_incomplete) && !member_array_is_incomplete) { - uint64_t parent_byte_size = - parent_die.GetAttributeValueAsUnsigned(DW_AT_byte_size, UINT64_MAX); + uint64_t parent_byte_size = parent_die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_byte_size, UINT64_MAX); if (attrs.member_byte_offset >= parent_byte_size) { if (member_array_size != 1 && @@ -2908,21 +2915,21 @@ dw_tag_t tag = die.Tag(); switch (tag) { - case DW_TAG_APPLE_property: + case llvm::dwarf::DW_TAG_APPLE_property: ParseObjCProperty(die, parent_die, class_clang_type, delayed_properties); break; - case DW_TAG_member: + case llvm::dwarf::DW_TAG_member: ParseSingleMember(die, parent_die, class_clang_type, default_accessibility, layout_info, last_field_info); break; - case DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_subprogram: // Let the type parsing code handle this one for us. member_function_dies.push_back(die); break; - case DW_TAG_inheritance: + case llvm::dwarf::DW_TAG_inheritance: ParseInheritance(die, parent_die, class_clang_type, default_accessibility, module_sp, base_classes, layout_info); break; @@ -2948,7 +2955,7 @@ for (DWARFDIE die : parent_die.children()) { const dw_tag_t tag = die.Tag(); switch (tag) { - case DW_TAG_formal_parameter: { + case llvm::dwarf::DW_TAG_formal_parameter: { DWARFAttributes attributes; const size_t num_attributes = die.GetAttributes(attributes); if (num_attributes > 0) { @@ -2964,26 +2971,26 @@ DWARFFormValue form_value; if (attributes.ExtractFormValueAtIndex(i, form_value)) { switch (attr) { - case DW_AT_name: + case llvm::dwarf::DW_AT_name: name = form_value.AsCString(); break; - case DW_AT_type: + case llvm::dwarf::DW_AT_type: param_type_die_form = form_value; break; - case DW_AT_artificial: + case llvm::dwarf::DW_AT_artificial: is_artificial = form_value.Boolean(); break; - case DW_AT_location: - case DW_AT_const_value: - case DW_AT_default_value: - case DW_AT_description: - case DW_AT_endianity: - case DW_AT_is_optional: - case DW_AT_segment: - case DW_AT_variable_parameter: + case llvm::dwarf::DW_AT_location: + case llvm::dwarf::DW_AT_const_value: + case llvm::dwarf::DW_AT_default_value: + case llvm::dwarf::DW_AT_description: + case llvm::dwarf::DW_AT_endianity: + case llvm::dwarf::DW_AT_is_optional: + case llvm::dwarf::DW_AT_segment: + case llvm::dwarf::DW_AT_variable_parameter: default: - case DW_AT_abstract_origin: - case DW_AT_sibling: + case llvm::dwarf::DW_AT_abstract_origin: + case llvm::dwarf::DW_AT_sibling: break; } } @@ -3035,13 +3042,13 @@ arg_idx++; } break; - case DW_TAG_unspecified_parameters: + case llvm::dwarf::DW_TAG_unspecified_parameters: is_variadic = true; break; - case DW_TAG_template_type_parameter: - case DW_TAG_template_value_parameter: - case DW_TAG_GNU_template_parameter_pack: + case llvm::dwarf::DW_TAG_template_type_parameter: + case llvm::dwarf::DW_TAG_template_value_parameter: + case llvm::dwarf::DW_TAG_GNU_template_parameter_pack: // The one caller of this was never using the template_param_infos, and // the local variable was taking up a large amount of stack space in // SymbolFileDWARF::ParseType() so this was removed. If we ever need the @@ -3066,7 +3073,7 @@ for (DWARFDIE die : parent_die.children()) { const dw_tag_t tag = die.Tag(); - if (tag != DW_TAG_subrange_type) + if (tag != llvm::dwarf::DW_TAG_subrange_type) continue; DWARFAttributes attributes; @@ -3082,12 +3089,13 @@ DWARFFormValue form_value; if (attributes.ExtractFormValueAtIndex(i, form_value)) { switch (attr) { - case DW_AT_name: + case llvm::dwarf::DW_AT_name: break; - case DW_AT_count: - if (DWARFDIE var_die = die.GetReferencedDIE(DW_AT_count)) { - if (var_die.Tag() == DW_TAG_variable) + case llvm::dwarf::DW_AT_count: + if (DWARFDIE var_die = + die.GetReferencedDIE(llvm::dwarf::DW_AT_count)) { + if (var_die.Tag() == llvm::dwarf::DW_TAG_variable) if (exe_ctx) { if (auto frame = exe_ctx->GetFrameSP()) { Status error; @@ -3105,35 +3113,35 @@ num_elements = form_value.Unsigned(); break; - case DW_AT_bit_stride: + case llvm::dwarf::DW_AT_bit_stride: array_info.bit_stride = form_value.Unsigned(); break; - case DW_AT_byte_stride: + case llvm::dwarf::DW_AT_byte_stride: array_info.byte_stride = form_value.Unsigned(); break; - case DW_AT_lower_bound: + case llvm::dwarf::DW_AT_lower_bound: lower_bound = form_value.Unsigned(); break; - case DW_AT_upper_bound: + case llvm::dwarf::DW_AT_upper_bound: upper_bound_valid = true; upper_bound = form_value.Unsigned(); break; default: - case DW_AT_abstract_origin: - case DW_AT_accessibility: - case DW_AT_allocated: - case DW_AT_associated: - case DW_AT_data_location: - case DW_AT_declaration: - case DW_AT_description: - case DW_AT_sibling: - case DW_AT_threads_scaled: - case DW_AT_type: - case DW_AT_visibility: + case llvm::dwarf::DW_AT_abstract_origin: + case llvm::dwarf::DW_AT_accessibility: + case llvm::dwarf::DW_AT_allocated: + case llvm::dwarf::DW_AT_associated: + case llvm::dwarf::DW_AT_data_location: + case llvm::dwarf::DW_AT_declaration: + case llvm::dwarf::DW_AT_description: + case llvm::dwarf::DW_AT_sibling: + case llvm::dwarf::DW_AT_threads_scaled: + case llvm::dwarf::DW_AT_type: + case llvm::dwarf::DW_AT_visibility: break; } } @@ -3161,7 +3169,7 @@ dw_attr_t attr = attributes.AttributeAtIndex(i); DWARFFormValue form_value; - if (attr == DW_AT_type && + if (attr == llvm::dwarf::DW_AT_type && attributes.ExtractFormValueAtIndex(i, form_value)) return dwarf->ResolveTypeUID(form_value.Reference(), true); } @@ -3176,11 +3184,11 @@ return nullptr; switch (die.Tag()) { - case DW_TAG_variable: - case DW_TAG_constant: - case DW_TAG_formal_parameter: - case DW_TAG_imported_declaration: - case DW_TAG_imported_module: + case llvm::dwarf::DW_TAG_variable: + case llvm::dwarf::DW_TAG_constant: + case llvm::dwarf::DW_TAG_formal_parameter: + case llvm::dwarf::DW_TAG_imported_declaration: + case llvm::dwarf::DW_TAG_imported_module: break; default: return nullptr; @@ -3190,14 +3198,15 @@ if (cache_pos != m_die_to_decl.end()) return cache_pos->second; - if (DWARFDIE spec_die = die.GetReferencedDIE(DW_AT_specification)) { + if (DWARFDIE spec_die = + die.GetReferencedDIE(llvm::dwarf::DW_AT_specification)) { clang::Decl *decl = GetClangDeclForDIE(spec_die); m_die_to_decl[die.GetDIE()] = decl; return decl; } if (DWARFDIE abstract_origin_die = - die.GetReferencedDIE(DW_AT_abstract_origin)) { + die.GetReferencedDIE(llvm::dwarf::DW_AT_abstract_origin)) { clang::Decl *decl = GetClangDeclForDIE(abstract_origin_die); m_die_to_decl[die.GetDIE()] = decl; return decl; @@ -3205,9 +3214,9 @@ clang::Decl *decl = nullptr; switch (die.Tag()) { - case DW_TAG_variable: - case DW_TAG_constant: - case DW_TAG_formal_parameter: { + case llvm::dwarf::DW_TAG_variable: + case llvm::dwarf::DW_TAG_constant: + case llvm::dwarf::DW_TAG_formal_parameter: { SymbolFileDWARF *dwarf = die.GetDWARF(); Type *type = GetTypeForDIE(die); if (dwarf && type) { @@ -3221,9 +3230,10 @@ } break; } - case DW_TAG_imported_declaration: { + case llvm::dwarf::DW_TAG_imported_declaration: { SymbolFileDWARF *dwarf = die.GetDWARF(); - DWARFDIE imported_uid = die.GetAttributeValueAsReferenceDIE(DW_AT_import); + DWARFDIE imported_uid = + die.GetAttributeValueAsReferenceDIE(llvm::dwarf::DW_AT_import); if (imported_uid) { CompilerDecl imported_decl = SymbolFileDWARF::GetDecl(imported_uid); if (imported_decl) { @@ -3239,9 +3249,10 @@ } break; } - case DW_TAG_imported_module: { + case llvm::dwarf::DW_TAG_imported_module: { SymbolFileDWARF *dwarf = die.GetDWARF(); - DWARFDIE imported_uid = die.GetAttributeValueAsReferenceDIE(DW_AT_import); + DWARFDIE imported_uid = + die.GetAttributeValueAsReferenceDIE(llvm::dwarf::DW_AT_import); if (imported_uid) { CompilerDeclContext imported_decl_ctx = @@ -3277,18 +3288,18 @@ bool try_parsing_type = true; switch (die.Tag()) { - case DW_TAG_compile_unit: - case DW_TAG_partial_unit: + case llvm::dwarf::DW_TAG_compile_unit: + case llvm::dwarf::DW_TAG_partial_unit: decl_ctx = m_ast.GetTranslationUnitDecl(); try_parsing_type = false; break; - case DW_TAG_namespace: + case llvm::dwarf::DW_TAG_namespace: decl_ctx = ResolveNamespaceDIE(die); try_parsing_type = false; break; - case DW_TAG_lexical_block: + case llvm::dwarf::DW_TAG_lexical_block: decl_ctx = GetDeclContextForBlock(die); try_parsing_type = false; break; @@ -3319,13 +3330,13 @@ for (DWARFDIE parent = die.GetParent(); parent.IsValid(); parent = parent.GetParent()) { const dw_tag_t tag = parent.Tag(); - if (tag == DW_TAG_module) { + if (tag == llvm::dwarf::DW_TAG_module) { DWARFDIE module_die = parent; auto it = m_die_to_module.find(module_die.GetDIE()); if (it != m_die_to_module.end()) return it->second; - const char *name = - module_die.GetAttributeValueAsString(DW_AT_name, nullptr); + const char *name = module_die.GetAttributeValueAsString( + llvm::dwarf::DW_AT_name, nullptr); if (!name) return {}; @@ -3340,8 +3351,8 @@ static bool IsSubroutine(const DWARFDIE &die) { switch (die.Tag()) { - case DW_TAG_subprogram: - case DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_inlined_subroutine: return true; default: return false; @@ -3351,7 +3362,7 @@ static DWARFDIE GetContainingFunctionWithAbstractOrigin(const DWARFDIE &die) { for (DWARFDIE candidate = die; candidate; candidate = candidate.GetParent()) { if (IsSubroutine(candidate)) { - if (candidate.GetReferencedDIE(DW_AT_abstract_origin)) { + if (candidate.GetReferencedDIE(llvm::dwarf::DW_AT_abstract_origin)) { return candidate; } else { return DWARFDIE(); @@ -3365,7 +3376,7 @@ static DWARFDIE FindAnyChildWithAbstractOrigin(const DWARFDIE &context) { for (DWARFDIE candidate : context.children()) { - if (candidate.GetReferencedDIE(DW_AT_abstract_origin)) { + if (candidate.GetReferencedDIE(llvm::dwarf::DW_AT_abstract_origin)) { return candidate; } } @@ -3387,7 +3398,7 @@ clang::DeclContext * DWARFASTParserClang::GetDeclContextForBlock(const DWARFDIE &die) { - assert(die.Tag() == DW_TAG_lexical_block); + assert(die.Tag() == llvm::dwarf::DW_TAG_lexical_block); DWARFDIE containing_function_with_abstract_origin = GetContainingFunctionWithAbstractOrigin(die); if (!containing_function_with_abstract_origin) { @@ -3401,7 +3412,7 @@ } clang::BlockDecl *DWARFASTParserClang::ResolveBlockDIE(const DWARFDIE &die) { - if (die && die.Tag() == DW_TAG_lexical_block) { + if (die && die.Tag() == llvm::dwarf::DW_TAG_lexical_block) { clang::BlockDecl *decl = llvm::cast_or_null(m_die_to_decl_ctx[die.GetDIE()]); @@ -3423,7 +3434,7 @@ clang::NamespaceDecl * DWARFASTParserClang::ResolveNamespaceDIE(const DWARFDIE &die) { - if (die && die.Tag() == DW_TAG_namespace) { + if (die && die.Tag() == llvm::dwarf::DW_TAG_namespace) { // See if we already parsed this namespace DIE and associated it with a // uniqued namespace declaration clang::NamespaceDecl *namespace_decl = @@ -3434,8 +3445,8 @@ const char *namespace_name = die.GetName(); clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE(die, nullptr); - bool is_inline = - die.GetAttributeValueAsUnsigned(DW_AT_export_symbols, 0) != 0; + bool is_inline = die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_export_symbols, 0) != 0; namespace_decl = m_ast.GetUniqueNamespaceDeclaration( namespace_name, containing_decl_ctx, GetOwningClangModule(die), @@ -3506,16 +3517,18 @@ UniqueCStringMap dst_name_to_die_artificial; for (src_die = src_class_die.GetFirstChild(); src_die.IsValid(); src_die = src_die.GetSibling()) { - if (src_die.Tag() == DW_TAG_subprogram) { + if (src_die.Tag() == llvm::dwarf::DW_TAG_subprogram) { // Make sure this is a declaration and not a concrete instance by looking // for DW_AT_declaration set to 1. Sometimes concrete function instances // are placed inside the class definitions and shouldn't be included in // the list of things are are tracking here. - if (src_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 1) { + if (src_die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_declaration, + 0) == 1) { const char *src_name = src_die.GetMangledName(); if (src_name) { ConstString src_const_name(src_name); - if (src_die.GetAttributeValueAsUnsigned(DW_AT_artificial, 0)) + if (src_die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_artificial, + 0)) src_name_to_die_artificial.Append(src_const_name, src_die); else src_name_to_die.Append(src_const_name, src_die); @@ -3525,16 +3538,18 @@ } for (dst_die = dst_class_die.GetFirstChild(); dst_die.IsValid(); dst_die = dst_die.GetSibling()) { - if (dst_die.Tag() == DW_TAG_subprogram) { + if (dst_die.Tag() == llvm::dwarf::DW_TAG_subprogram) { // Make sure this is a declaration and not a concrete instance by looking // for DW_AT_declaration set to 1. Sometimes concrete function instances // are placed inside the class definitions and shouldn't be included in // the list of things are are tracking here. - if (dst_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 1) { + if (dst_die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_declaration, + 0) == 1) { const char *dst_name = dst_die.GetMangledName(); if (dst_name) { ConstString dst_const_name(dst_name); - if (dst_die.GetAttributeValueAsUnsigned(DW_AT_artificial, 0)) + if (dst_die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_artificial, + 0)) dst_name_to_die_artificial.Append(dst_const_name, dst_die); else dst_name_to_die.Append(dst_const_name, dst_die); Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp @@ -33,7 +33,7 @@ m_attributes.clear(); m_tag = static_cast(data.GetULEB128(offset_ptr)); - if (m_tag == DW_TAG_null) + if (m_tag == llvm::dwarf::DW_TAG_null) return llvm::make_error( "abbrev decl requires non-null tag."); @@ -55,7 +55,7 @@ DWARFFormValue::ValueType val; - if (form == DW_FORM_implicit_const) + if (form == llvm::dwarf::DW_FORM_implicit_const) val.value.sval = data.GetSLEB128(offset_ptr); m_attributes.push_back(DWARFAttribute(attr, form, val)); Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp @@ -38,7 +38,7 @@ const DWARFUnit *cu = CompileUnitAtIndex(i); form_value.SetUnit(cu); form_value.SetForm(FormAtIndex(i)); - if (form_value.Form() == DW_FORM_implicit_const) { + if (form_value.Form() == llvm::dwarf::DW_FORM_implicit_const) { form_value.SetValue(ValueAtIndex(i)); return true; } Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -42,7 +42,8 @@ m_worklist.pop_back(); // And add back any items that elaborate it. - for (dw_attr_t attr : {DW_AT_specification, DW_AT_abstract_origin}) { + for (dw_attr_t attr : {llvm::dwarf::DW_AT_specification, + llvm::dwarf::DW_AT_abstract_origin}) { if (DWARFDIE d = die.GetReferencedDIE(attr)) if (m_seen.insert(die.GetDIE()).second) m_worklist.push_back(d); @@ -148,22 +149,22 @@ bool check_children = false; bool match_addr_range = false; switch (Tag()) { - case DW_TAG_class_type: - case DW_TAG_namespace: - case DW_TAG_structure_type: - case DW_TAG_common_block: + case llvm::dwarf::DW_TAG_class_type: + case llvm::dwarf::DW_TAG_namespace: + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_common_block: check_children = true; break; - case DW_TAG_compile_unit: - case DW_TAG_module: - case DW_TAG_catch_block: - case DW_TAG_subprogram: - case DW_TAG_try_block: - case DW_TAG_partial_unit: + case llvm::dwarf::DW_TAG_compile_unit: + case llvm::dwarf::DW_TAG_module: + case llvm::dwarf::DW_TAG_catch_block: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_try_block: + case llvm::dwarf::DW_TAG_partial_unit: match_addr_range = true; break; - case DW_TAG_lexical_block: - case DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_lexical_block: + case llvm::dwarf::DW_TAG_inlined_subroutine: check_children = true; match_addr_range = true; break; @@ -181,8 +182,8 @@ default: break; - case DW_TAG_inlined_subroutine: // Inlined Function - case DW_TAG_lexical_block: // Block { } in code + case llvm::dwarf::DW_TAG_inlined_subroutine: // Inlined Function + case llvm::dwarf::DW_TAG_lexical_block: // Block { } in code result = *this; break; } @@ -233,7 +234,8 @@ s.PutCString("NULL"); return; } - const char *name = GetDIE()->GetAttributeValueAsString(GetCU(), DW_AT_name, nullptr, true); + const char *name = GetDIE()->GetAttributeValueAsString( + GetCU(), llvm::dwarf::DW_AT_name, nullptr, true); if (!name) return; s.PutCString(name); @@ -256,67 +258,67 @@ return; } switch (Tag()) { - case DW_TAG_array_type: + case llvm::dwarf::DW_TAG_array_type: break; // print out a "[]" after printing the full type of the element // below - case DW_TAG_base_type: + case llvm::dwarf::DW_TAG_base_type: s.PutCString("base "); break; - case DW_TAG_class_type: + case llvm::dwarf::DW_TAG_class_type: s.PutCString("class "); break; - case DW_TAG_const_type: + case llvm::dwarf::DW_TAG_const_type: s.PutCString("const "); break; - case DW_TAG_enumeration_type: + case llvm::dwarf::DW_TAG_enumeration_type: s.PutCString("enum "); break; - case DW_TAG_file_type: + case llvm::dwarf::DW_TAG_file_type: s.PutCString("file "); break; - case DW_TAG_interface_type: + case llvm::dwarf::DW_TAG_interface_type: s.PutCString("interface "); break; - case DW_TAG_packed_type: + case llvm::dwarf::DW_TAG_packed_type: s.PutCString("packed "); break; - case DW_TAG_pointer_type: + case llvm::dwarf::DW_TAG_pointer_type: break; // print out a '*' after printing the full type below - case DW_TAG_ptr_to_member_type: + case llvm::dwarf::DW_TAG_ptr_to_member_type: break; // print out a '*' after printing the full type below - case DW_TAG_reference_type: + case llvm::dwarf::DW_TAG_reference_type: break; // print out a '&' after printing the full type below - case DW_TAG_restrict_type: + case llvm::dwarf::DW_TAG_restrict_type: s.PutCString("restrict "); break; - case DW_TAG_set_type: + case llvm::dwarf::DW_TAG_set_type: s.PutCString("set "); break; - case DW_TAG_shared_type: + case llvm::dwarf::DW_TAG_shared_type: s.PutCString("shared "); break; - case DW_TAG_string_type: + case llvm::dwarf::DW_TAG_string_type: s.PutCString("string "); break; - case DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_structure_type: s.PutCString("struct "); break; - case DW_TAG_subrange_type: + case llvm::dwarf::DW_TAG_subrange_type: s.PutCString("subrange "); break; - case DW_TAG_subroutine_type: + case llvm::dwarf::DW_TAG_subroutine_type: s.PutCString("function "); break; - case DW_TAG_thrown_type: + case llvm::dwarf::DW_TAG_thrown_type: s.PutCString("thrown "); break; - case DW_TAG_union_type: + case llvm::dwarf::DW_TAG_union_type: s.PutCString("union "); break; - case DW_TAG_unspecified_type: + case llvm::dwarf::DW_TAG_unspecified_type: s.PutCString("unspecified "); break; - case DW_TAG_volatile_type: + case llvm::dwarf::DW_TAG_volatile_type: s.PutCString("volatile "); break; default: @@ -324,20 +326,21 @@ } // Follow the DW_AT_type if possible - if (DWARFDIE next_die = GetAttributeValueAsReferenceDIE(DW_AT_type)) + if (DWARFDIE next_die = + GetAttributeValueAsReferenceDIE(llvm::dwarf::DW_AT_type)) next_die.AppendTypeName(s); switch (Tag()) { - case DW_TAG_array_type: + case llvm::dwarf::DW_TAG_array_type: s.PutCString("[]"); break; - case DW_TAG_pointer_type: + case llvm::dwarf::DW_TAG_pointer_type: s.PutChar('*'); break; - case DW_TAG_ptr_to_member_type: + case llvm::dwarf::DW_TAG_ptr_to_member_type: s.PutChar('*'); break; - case DW_TAG_reference_type: + case llvm::dwarf::DW_TAG_reference_type: s.PutChar('&'); break; default: @@ -375,39 +378,40 @@ void DWARFDIE::GetDeclContext( llvm::SmallVectorImpl &context) const { const dw_tag_t tag = Tag(); - if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit) + if (tag == llvm::dwarf::DW_TAG_compile_unit || + tag == llvm::dwarf::DW_TAG_partial_unit) return; DWARFDIE parent = GetParent(); if (parent) parent.GetDeclContext(context); switch (tag) { - case DW_TAG_module: + case llvm::dwarf::DW_TAG_module: context.push_back({CompilerContextKind::Module, ConstString(GetName())}); break; - case DW_TAG_namespace: + case llvm::dwarf::DW_TAG_namespace: context.push_back({CompilerContextKind::Namespace, ConstString(GetName())}); break; - case DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_structure_type: context.push_back({CompilerContextKind::Struct, ConstString(GetName())}); break; - case DW_TAG_union_type: + case llvm::dwarf::DW_TAG_union_type: context.push_back({CompilerContextKind::Union, ConstString(GetName())}); break; - case DW_TAG_class_type: + case llvm::dwarf::DW_TAG_class_type: context.push_back({CompilerContextKind::Class, ConstString(GetName())}); break; - case DW_TAG_enumeration_type: + case llvm::dwarf::DW_TAG_enumeration_type: context.push_back({CompilerContextKind::Enum, ConstString(GetName())}); break; - case DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_subprogram: context.push_back( {CompilerContextKind::Function, ConstString(GetPubname())}); break; - case DW_TAG_variable: + case llvm::dwarf::DW_TAG_variable: context.push_back( {CompilerContextKind::Variable, ConstString(GetPubname())}); break; - case DW_TAG_typedef: + case llvm::dwarf::DW_TAG_typedef: context.push_back({CompilerContextKind::Typedef, ConstString(GetName())}); break; default: @@ -425,8 +429,9 @@ bool DWARFDIE::IsStructUnionOrClass() const { const dw_tag_t tag = Tag(); - return tag == DW_TAG_class_type || tag == DW_TAG_structure_type || - tag == DW_TAG_union_type; + return tag == llvm::dwarf::DW_TAG_class_type || + tag == llvm::dwarf::DW_TAG_structure_type || + tag == llvm::dwarf::DW_TAG_union_type; } bool DWARFDIE::IsMethod() const { Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -39,6 +39,8 @@ bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor &data, const DWARFUnit *cu, lldb::offset_t *offset_ptr) { + using namespace llvm::dwarf; + m_offset = *offset_ptr; m_parent_idx = 0; m_sibling_idx = 0; @@ -208,7 +210,7 @@ const DWARFDebugInfoEntry &die, const DWARFFormValue &value) { llvm::Expected expected_ranges = - (value.Form() == DW_FORM_rnglistx) + (value.Form() == llvm::dwarf::DW_FORM_rnglistx) ? unit.FindRnglistFromIndex(value.Unsigned()) : unit.FindRnglistFromOffset(value.Unsigned()); if (expected_ranges) @@ -259,7 +261,7 @@ if (form_value.ExtractValue(data, &offset)) { switch (attr) { - case DW_AT_low_pc: + case llvm::dwarf::DW_AT_low_pc: lo_pc = form_value.Address(); if (do_offset) @@ -267,14 +269,14 @@ do_offset = false; break; - case DW_AT_entry_pc: + case llvm::dwarf::DW_AT_entry_pc: lo_pc = form_value.Address(); break; - case DW_AT_high_pc: - if (form_value.Form() == DW_FORM_addr || - form_value.Form() == DW_FORM_addrx || - form_value.Form() == DW_FORM_GNU_addr_index) { + case llvm::dwarf::DW_AT_high_pc: + if (form_value.Form() == llvm::dwarf::DW_FORM_addr || + form_value.Form() == llvm::dwarf::DW_FORM_addrx || + form_value.Form() == llvm::dwarf::DW_FORM_GNU_addr_index) { hi_pc = form_value.Address(); } else { hi_pc = form_value.Unsigned(); @@ -286,60 +288,60 @@ } break; - case DW_AT_ranges: + case llvm::dwarf::DW_AT_ranges: ranges = GetRangesOrReportError(*cu, *this, form_value); break; - case DW_AT_name: + case llvm::dwarf::DW_AT_name: if (name == nullptr) name = form_value.AsCString(); break; - case DW_AT_MIPS_linkage_name: - case DW_AT_linkage_name: + case llvm::dwarf::DW_AT_MIPS_linkage_name: + case llvm::dwarf::DW_AT_linkage_name: if (mangled == nullptr) mangled = form_value.AsCString(); break; - case DW_AT_abstract_origin: + case llvm::dwarf::DW_AT_abstract_origin: dies.push_back(form_value.Reference()); break; - case DW_AT_specification: + case llvm::dwarf::DW_AT_specification: dies.push_back(form_value.Reference()); break; - case DW_AT_decl_file: + case llvm::dwarf::DW_AT_decl_file: if (decl_file == 0) decl_file = form_value.Unsigned(); break; - case DW_AT_decl_line: + case llvm::dwarf::DW_AT_decl_line: if (decl_line == 0) decl_line = form_value.Unsigned(); break; - case DW_AT_decl_column: + case llvm::dwarf::DW_AT_decl_column: if (decl_column == 0) decl_column = form_value.Unsigned(); break; - case DW_AT_call_file: + case llvm::dwarf::DW_AT_call_file: if (call_file == 0) call_file = form_value.Unsigned(); break; - case DW_AT_call_line: + case llvm::dwarf::DW_AT_call_line: if (call_line == 0) call_line = form_value.Unsigned(); break; - case DW_AT_call_column: + case llvm::dwarf::DW_AT_call_column: if (call_column == 0) call_column = form_value.Unsigned(); break; - case DW_AT_frame_base: + case llvm::dwarf::DW_AT_frame_base: if (frame_base) { if (form_value.BlockData()) { uint32_t block_offset = @@ -423,8 +425,8 @@ // attributes, the depth will be non-zero. We need to omit certain // attributes that don't make sense. switch (attr) { - case DW_AT_sibling: - case DW_AT_declaration: + case llvm::dwarf::DW_AT_sibling: + case llvm::dwarf::DW_AT_declaration: if (curr_depth > 0) { // This attribute doesn't make sense when combined with the DIE that // references this DIE. We know a DIE is referencing this DIE because @@ -438,7 +440,8 @@ } if (recurse == Recurse::yes && - ((attr == DW_AT_specification) || (attr == DW_AT_abstract_origin))) { + ((attr == llvm::dwarf::DW_AT_specification) || + (attr == llvm::dwarf::DW_AT_abstract_origin))) { if (form_value.ExtractValue(data, &offset)) { DWARFDIE spec_die = form_value.Reference(); if (spec_die) @@ -493,7 +496,7 @@ } if (check_specification_or_abstract_origin) { - if (GetAttributeValue(cu, DW_AT_specification, form_value)) { + if (GetAttributeValue(cu, llvm::dwarf::DW_AT_specification, form_value)) { DWARFDIE die = form_value.Reference(); if (die) { dw_offset_t die_offset = die.GetDIE()->GetAttributeValue( @@ -503,7 +506,7 @@ } } - if (GetAttributeValue(cu, DW_AT_abstract_origin, form_value)) { + if (GetAttributeValue(cu, llvm::dwarf::DW_AT_abstract_origin, form_value)) { DWARFDIE die = form_value.Reference(); if (die) { dw_offset_t die_offset = die.GetDIE()->GetAttributeValue( @@ -579,11 +582,12 @@ const DWARFUnit *cu, dw_addr_t lo_pc, uint64_t fail_value, bool check_specification_or_abstract_origin) const { DWARFFormValue form_value; - if (GetAttributeValue(cu, DW_AT_high_pc, form_value, nullptr, + if (GetAttributeValue(cu, llvm::dwarf::DW_AT_high_pc, form_value, nullptr, check_specification_or_abstract_origin)) { dw_form_t form = form_value.Form(); - if (form == DW_FORM_addr || form == DW_FORM_addrx || - form == DW_FORM_GNU_addr_index) + if (form == llvm::dwarf::DW_FORM_addr || + form == llvm::dwarf::DW_FORM_addrx || + form == llvm::dwarf::DW_FORM_GNU_addr_index) return form_value.Address(); // DWARF4 can specify the hi_pc as an @@ -601,7 +605,7 @@ bool DWARFDebugInfoEntry::GetAttributeAddressRange( const DWARFUnit *cu, dw_addr_t &lo_pc, dw_addr_t &hi_pc, uint64_t fail_value, bool check_specification_or_abstract_origin) const { - lo_pc = GetAttributeValueAsAddress(cu, DW_AT_low_pc, fail_value, + lo_pc = GetAttributeValueAsAddress(cu, llvm::dwarf::DW_AT_low_pc, fail_value, check_specification_or_abstract_origin); if (lo_pc != fail_value) { hi_pc = GetAttributeHighPC(cu, lo_pc, fail_value, @@ -620,7 +624,7 @@ ranges.Clear(); DWARFFormValue form_value; - if (GetAttributeValue(cu, DW_AT_ranges, form_value)) { + if (GetAttributeValue(cu, llvm::dwarf::DW_AT_ranges, form_value)) { ranges = GetRangesOrReportError(*cu, *this, form_value); } else if (check_hi_lo_pc) { dw_addr_t lo_pc = LLDB_INVALID_ADDRESS; @@ -639,7 +643,7 @@ // Get value of the DW_AT_name attribute and return it if one exists, else // return NULL. const char *DWARFDebugInfoEntry::GetName(const DWARFUnit *cu) const { - return GetAttributeValueAsString(cu, DW_AT_name, nullptr, true); + return GetAttributeValueAsString(cu, llvm::dwarf::DW_AT_name, nullptr, true); } // GetMangledName @@ -651,18 +655,20 @@ bool substitute_name_allowed) const { const char *name = nullptr; - name = GetAttributeValueAsString(cu, DW_AT_MIPS_linkage_name, nullptr, true); + name = GetAttributeValueAsString(cu, llvm::dwarf::DW_AT_MIPS_linkage_name, + nullptr, true); if (name) return name; - name = GetAttributeValueAsString(cu, DW_AT_linkage_name, nullptr, true); + name = GetAttributeValueAsString(cu, llvm::dwarf::DW_AT_linkage_name, nullptr, + true); if (name) return name; if (!substitute_name_allowed) return nullptr; - name = GetAttributeValueAsString(cu, DW_AT_name, nullptr, true); + name = GetAttributeValueAsString(cu, llvm::dwarf::DW_AT_name, nullptr, true); return name; } @@ -675,15 +681,17 @@ if (!cu) return name; - name = GetAttributeValueAsString(cu, DW_AT_MIPS_linkage_name, nullptr, true); + name = GetAttributeValueAsString(cu, llvm::dwarf::DW_AT_MIPS_linkage_name, + nullptr, true); if (name) return name; - name = GetAttributeValueAsString(cu, DW_AT_linkage_name, nullptr, true); + name = GetAttributeValueAsString(cu, llvm::dwarf::DW_AT_linkage_name, nullptr, + true); if (name) return name; - name = GetAttributeValueAsString(cu, DW_AT_name, nullptr, true); + name = GetAttributeValueAsString(cu, llvm::dwarf::DW_AT_name, nullptr, true); return name; } @@ -693,7 +701,7 @@ void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable( DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const { if (m_tag) { - if (m_tag == DW_TAG_subprogram) { + if (m_tag == llvm::dwarf::DW_TAG_subprogram) { DWARFRangeList ranges; GetAttributeAddressRanges(cu, ranges, /*check_hi_lo_pc=*/true); @@ -717,14 +725,15 @@ DWARFDeclContext dwarf_decl_ctx; for (;;) { const dw_tag_t tag = die->Tag(); - if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit) + if (tag == llvm::dwarf::DW_TAG_compile_unit || + tag == llvm::dwarf::DW_TAG_partial_unit) return dwarf_decl_ctx; dwarf_decl_ctx.AppendDeclContext(tag, die->GetName(cu)); DWARFDIE parent_decl_ctx_die = die->GetParentDeclContextDIE(cu); if (!parent_decl_ctx_die || parent_decl_ctx_die.GetDIE() == die) return dwarf_decl_ctx; - if (parent_decl_ctx_die.Tag() == DW_TAG_compile_unit || - parent_decl_ctx_die.Tag() == DW_TAG_partial_unit) + if (parent_decl_ctx_die.Tag() == llvm::dwarf::DW_TAG_compile_unit || + parent_decl_ctx_die.Tag() == llvm::dwarf::DW_TAG_partial_unit) return dwarf_decl_ctx; die = parent_decl_ctx_die.GetDIE(); cu = parent_decl_ctx_die.GetCU(); @@ -753,12 +762,12 @@ // our decl context... if (die.GetDIE() != this) { switch (die.Tag()) { - case DW_TAG_compile_unit: - case DW_TAG_partial_unit: - case DW_TAG_namespace: - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_class_type: + case llvm::dwarf::DW_TAG_compile_unit: + case llvm::dwarf::DW_TAG_partial_unit: + case llvm::dwarf::DW_TAG_namespace: + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_union_type: + case llvm::dwarf::DW_TAG_class_type: return die; default: @@ -766,14 +775,16 @@ } } - DWARFDIE spec_die = attributes.FormValueAsReference(DW_AT_specification); + DWARFDIE spec_die = + attributes.FormValueAsReference(llvm::dwarf::DW_AT_specification); if (spec_die) { DWARFDIE decl_ctx_die = spec_die.GetParentDeclContextDIE(); if (decl_ctx_die) return decl_ctx_die; } - DWARFDIE abs_die = attributes.FormValueAsReference(DW_AT_abstract_origin); + DWARFDIE abs_die = + attributes.FormValueAsReference(llvm::dwarf::DW_AT_abstract_origin); if (abs_die) { DWARFDIE decl_ctx_die = abs_die.GetParentDeclContextDIE(); if (decl_ctx_die) @@ -806,7 +817,7 @@ while (parent_decl_ctx_die) { const dw_tag_t parent_tag = parent_decl_ctx_die.Tag(); switch (parent_tag) { - case DW_TAG_namespace: { + case llvm::dwarf::DW_TAG_namespace: { const char *namespace_name = parent_decl_ctx_die.GetName(); if (namespace_name) { storage.insert(0, "::"); @@ -817,9 +828,9 @@ parent_decl_ctx_die = parent_decl_ctx_die.GetParentDeclContextDIE(); } break; - case DW_TAG_class_type: - case DW_TAG_structure_type: - case DW_TAG_union_type: { + case llvm::dwarf::DW_TAG_class_type: + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_union_type: { const char *class_union_struct_name = parent_decl_ctx_die.GetName(); if (class_union_struct_name) { @@ -860,18 +871,18 @@ } bool DWARFDebugInfoEntry::IsGlobalOrStaticScopeVariable() const { - if (Tag() != DW_TAG_variable) + if (Tag() != llvm::dwarf::DW_TAG_variable) return false; const DWARFDebugInfoEntry *parent_die = GetParent(); while (parent_die != nullptr) { switch (parent_die->Tag()) { - case DW_TAG_subprogram: - case DW_TAG_lexical_block: - case DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_lexical_block: + case llvm::dwarf::DW_TAG_inlined_subroutine: return false; - case DW_TAG_compile_unit: - case DW_TAG_partial_unit: + case llvm::dwarf::DW_TAG_compile_unit: + case llvm::dwarf::DW_TAG_partial_unit: return true; default: Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp @@ -70,43 +70,43 @@ uint32_t debug_line_file_idx = 0; switch (type) { - case DW_MACRO_define: - case DW_MACRO_undef: + case llvm::dwarf::DW_MACRO_define: + case llvm::dwarf::DW_MACRO_undef: line = debug_macro_data.GetULEB128(offset); macro_str = debug_macro_data.GetCStr(offset); - if (type == DW_MACRO_define) + if (type == llvm::dwarf::DW_MACRO_define) debug_macros_sp->AddMacroEntry( DebugMacroEntry::CreateDefineEntry(line, macro_str)); else debug_macros_sp->AddMacroEntry( DebugMacroEntry::CreateUndefEntry(line, macro_str)); break; - case DW_MACRO_define_strp: - case DW_MACRO_undef_strp: + case llvm::dwarf::DW_MACRO_define_strp: + case llvm::dwarf::DW_MACRO_undef_strp: line = debug_macro_data.GetULEB128(offset); if (offset_is_64_bit) str_offset = debug_macro_data.GetU64(offset); else str_offset = debug_macro_data.GetU32(offset); macro_str = debug_str_data.GetCStr(&str_offset); - if (type == DW_MACRO_define_strp) + if (type == llvm::dwarf::DW_MACRO_define_strp) debug_macros_sp->AddMacroEntry( DebugMacroEntry::CreateDefineEntry(line, macro_str)); else debug_macros_sp->AddMacroEntry( DebugMacroEntry::CreateUndefEntry(line, macro_str)); break; - case DW_MACRO_start_file: + case llvm::dwarf::DW_MACRO_start_file: line = debug_macro_data.GetULEB128(offset); debug_line_file_idx = debug_macro_data.GetULEB128(offset); debug_macros_sp->AddMacroEntry( DebugMacroEntry::CreateStartFileEntry(line, debug_line_file_idx)); break; - case DW_MACRO_end_file: + case llvm::dwarf::DW_MACRO_end_file: // This operation has no operands. debug_macros_sp->AddMacroEntry(DebugMacroEntry::CreateEndFileEntry()); break; - case DW_MACRO_import: + case llvm::dwarf::DW_MACRO_import: if (offset_is_64_bit) new_offset = debug_macro_data.GetU64(offset); else Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp @@ -30,13 +30,13 @@ if (pos != begin) m_qualified_name.append("::"); if (pos->name == nullptr) { - if (pos->tag == DW_TAG_namespace) + if (pos->tag == llvm::dwarf::DW_TAG_namespace) m_qualified_name.append("(anonymous namespace)"); - else if (pos->tag == DW_TAG_class_type) + else if (pos->tag == llvm::dwarf::DW_TAG_class_type) m_qualified_name.append("(anonymous class)"); - else if (pos->tag == DW_TAG_structure_type) + else if (pos->tag == llvm::dwarf::DW_TAG_structure_type) m_qualified_name.append("(anonymous struct)"); - else if (pos->tag == DW_TAG_union_type) + else if (pos->tag == llvm::dwarf::DW_TAG_union_type) m_qualified_name.append("(anonymous union)"); else m_qualified_name.append("(anonymous)"); @@ -68,11 +68,11 @@ if (pos->tag != rhs_pos->tag) { // Check for DW_TAG_structure_type and DW_TAG_class_type as they are // often used interchangeably in GCC - if (pos->tag == DW_TAG_structure_type && - rhs_pos->tag == DW_TAG_class_type) + if (pos->tag == llvm::dwarf::DW_TAG_structure_type && + rhs_pos->tag == llvm::dwarf::DW_TAG_class_type) continue; - if (pos->tag == DW_TAG_class_type && - rhs_pos->tag == DW_TAG_structure_type) + if (pos->tag == llvm::dwarf::DW_TAG_class_type && + rhs_pos->tag == llvm::dwarf::DW_TAG_structure_type) continue; return false; } Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -29,6 +29,8 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, lldb::offset_t *offset_ptr) { + using namespace llvm::dwarf; + if (m_form == DW_FORM_implicit_const) return true; @@ -188,9 +190,9 @@ llvm::Optional DWARFFormValue::GetFixedSize(dw_form_t form, const DWARFUnit *u) { - if (form <= DW_FORM_ref_sig8 && g_form_sizes[form].valid) + if (form <= llvm::dwarf::DW_FORM_ref_sig8 && g_form_sizes[form].valid) return g_form_sizes[form].size; - if (form == DW_FORM_addr && u) + if (form == llvm::dwarf::DW_FORM_addr && u) return u->GetAddressByteSize(); return llvm::None; } @@ -208,6 +210,8 @@ const DWARFDataExtractor &debug_info_data, lldb::offset_t *offset_ptr, const DWARFUnit *unit) { + using namespace llvm::dwarf; + uint8_t ref_addr_size; switch (form) { // Blocks if inlined data that have a length field and the data bytes inlined @@ -331,6 +335,8 @@ } void DWARFFormValue::Dump(Stream &s) const { + using namespace llvm::dwarf; + uint64_t uvalue = Unsigned(); bool unit_relative_offset = false; @@ -458,14 +464,17 @@ const char *DWARFFormValue::AsCString() const { DWARFContext &context = m_unit->GetSymbolFileDWARF().GetDWARFContext(); - if (m_form == DW_FORM_string) + if (m_form == llvm::dwarf::DW_FORM_string) return m_value.value.cstr; - if (m_form == DW_FORM_strp) + if (m_form == llvm::dwarf::DW_FORM_strp) return context.getOrLoadStrData().PeekCStr(m_value.value.uval); - if (m_form == DW_FORM_GNU_str_index || m_form == DW_FORM_strx || - m_form == DW_FORM_strx1 || m_form == DW_FORM_strx2 || - m_form == DW_FORM_strx3 || m_form == DW_FORM_strx4) { + if (m_form == llvm::dwarf::DW_FORM_GNU_str_index || + m_form == llvm::dwarf::DW_FORM_strx || + m_form == llvm::dwarf::DW_FORM_strx1 || + m_form == llvm::dwarf::DW_FORM_strx2 || + m_form == llvm::dwarf::DW_FORM_strx3 || + m_form == llvm::dwarf::DW_FORM_strx4) { llvm::Optional offset = m_unit->GetStringOffsetSectionItem(m_value.value.uval); @@ -474,7 +483,7 @@ return context.getOrLoadStrData().PeekCStr(*offset); } - if (m_form == DW_FORM_line_strp) + if (m_form == llvm::dwarf::DW_FORM_line_strp) return context.getOrLoadLineStrData().PeekCStr(m_value.value.uval); return nullptr; @@ -483,13 +492,16 @@ dw_addr_t DWARFFormValue::Address() const { SymbolFileDWARF &symbol_file = m_unit->GetSymbolFileDWARF(); - if (m_form == DW_FORM_addr) + if (m_form == llvm::dwarf::DW_FORM_addr) return Unsigned(); assert(m_unit); - assert(m_form == DW_FORM_GNU_addr_index || m_form == DW_FORM_addrx || - m_form == DW_FORM_addrx1 || m_form == DW_FORM_addrx2 || - m_form == DW_FORM_addrx3 || m_form == DW_FORM_addrx4); + assert(m_form == llvm::dwarf::DW_FORM_GNU_addr_index || + m_form == llvm::dwarf::DW_FORM_addrx || + m_form == llvm::dwarf::DW_FORM_addrx1 || + m_form == llvm::dwarf::DW_FORM_addrx2 || + m_form == llvm::dwarf::DW_FORM_addrx3 || + m_form == llvm::dwarf::DW_FORM_addrx4); uint32_t index_size = m_unit->GetAddressByteSize(); dw_offset_t addr_base = m_unit->GetAddrBase(); @@ -501,11 +513,11 @@ DWARFDIE DWARFFormValue::Reference() const { uint64_t value = m_value.value.uval; switch (m_form) { - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: + case llvm::dwarf::DW_FORM_ref1: + case llvm::dwarf::DW_FORM_ref2: + case llvm::dwarf::DW_FORM_ref4: + case llvm::dwarf::DW_FORM_ref8: + case llvm::dwarf::DW_FORM_ref_udata: assert(m_unit); // Unit must be valid for DW_FORM_ref forms that are compile // unit relative or we will get this wrong value += m_unit->GetOffset(); @@ -517,7 +529,7 @@ } return const_cast(m_unit)->GetDIE(value); - case DW_FORM_ref_addr: { + case llvm::dwarf::DW_FORM_ref_addr: { DWARFUnit *ref_cu = m_unit->GetSymbolFileDWARF().DebugInfo().GetUnitContainingDIEOffset( DIERef::Section::DebugInfo, value); @@ -530,7 +542,7 @@ return ref_cu->GetDIE(value); } - case DW_FORM_ref_sig8: { + case llvm::dwarf::DW_FORM_ref_sig8: { DWARFTypeUnit *tu = m_unit->GetSymbolFileDWARF().DebugInfo().GetTypeUnitForHash(value); if (!tu) @@ -546,16 +558,16 @@ uint64_t DWARFFormValue::Reference(dw_offset_t base_offset) const { uint64_t value = m_value.value.uval; switch (m_form) { - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: + case llvm::dwarf::DW_FORM_ref1: + case llvm::dwarf::DW_FORM_ref2: + case llvm::dwarf::DW_FORM_ref4: + case llvm::dwarf::DW_FORM_ref8: + case llvm::dwarf::DW_FORM_ref_udata: return value + base_offset; - case DW_FORM_ref_addr: - case DW_FORM_ref_sig8: - case DW_FORM_GNU_ref_alt: + case llvm::dwarf::DW_FORM_ref_addr: + case llvm::dwarf::DW_FORM_ref_sig8: + case llvm::dwarf::DW_FORM_GNU_ref_alt: return value; default: @@ -567,11 +579,11 @@ bool DWARFFormValue::IsBlockForm(const dw_form_t form) { switch (form) { - case DW_FORM_exprloc: - case DW_FORM_block: - case DW_FORM_block1: - case DW_FORM_block2: - case DW_FORM_block4: + case llvm::dwarf::DW_FORM_exprloc: + case llvm::dwarf::DW_FORM_block: + case llvm::dwarf::DW_FORM_block1: + case llvm::dwarf::DW_FORM_block2: + case llvm::dwarf::DW_FORM_block4: return true; } return false; @@ -579,12 +591,12 @@ bool DWARFFormValue::IsDataForm(const dw_form_t form) { switch (form) { - case DW_FORM_sdata: - case DW_FORM_udata: - case DW_FORM_data1: - case DW_FORM_data2: - case DW_FORM_data4: - case DW_FORM_data8: + case llvm::dwarf::DW_FORM_sdata: + case llvm::dwarf::DW_FORM_udata: + case llvm::dwarf::DW_FORM_data1: + case llvm::dwarf::DW_FORM_data2: + case llvm::dwarf::DW_FORM_data4: + case llvm::dwarf::DW_FORM_data8: return true; } return false; @@ -592,46 +604,46 @@ bool DWARFFormValue::FormIsSupported(dw_form_t form) { switch (form) { - case DW_FORM_addr: - case DW_FORM_addrx: - case DW_FORM_loclistx: - case DW_FORM_rnglistx: - case DW_FORM_block2: - case DW_FORM_block4: - case DW_FORM_data2: - case DW_FORM_data4: - case DW_FORM_data8: - case DW_FORM_string: - case DW_FORM_block: - case DW_FORM_block1: - case DW_FORM_data1: - case DW_FORM_flag: - case DW_FORM_sdata: - case DW_FORM_strp: - case DW_FORM_line_strp: - case DW_FORM_strx: - case DW_FORM_strx1: - case DW_FORM_strx2: - case DW_FORM_strx3: - case DW_FORM_strx4: - case DW_FORM_udata: - case DW_FORM_ref_addr: - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: - case DW_FORM_indirect: - case DW_FORM_sec_offset: - case DW_FORM_exprloc: - case DW_FORM_flag_present: - case DW_FORM_ref_sig8: - case DW_FORM_GNU_str_index: - case DW_FORM_GNU_addr_index: - case DW_FORM_implicit_const: - return true; - default: - break; + case llvm::dwarf::DW_FORM_addr: + case llvm::dwarf::DW_FORM_addrx: + case llvm::dwarf::DW_FORM_loclistx: + case llvm::dwarf::DW_FORM_rnglistx: + case llvm::dwarf::DW_FORM_block2: + case llvm::dwarf::DW_FORM_block4: + case llvm::dwarf::DW_FORM_data2: + case llvm::dwarf::DW_FORM_data4: + case llvm::dwarf::DW_FORM_data8: + case llvm::dwarf::DW_FORM_string: + case llvm::dwarf::DW_FORM_block: + case llvm::dwarf::DW_FORM_block1: + case llvm::dwarf::DW_FORM_data1: + case llvm::dwarf::DW_FORM_flag: + case llvm::dwarf::DW_FORM_sdata: + case llvm::dwarf::DW_FORM_strp: + case llvm::dwarf::DW_FORM_line_strp: + case llvm::dwarf::DW_FORM_strx: + case llvm::dwarf::DW_FORM_strx1: + case llvm::dwarf::DW_FORM_strx2: + case llvm::dwarf::DW_FORM_strx3: + case llvm::dwarf::DW_FORM_strx4: + case llvm::dwarf::DW_FORM_udata: + case llvm::dwarf::DW_FORM_ref_addr: + case llvm::dwarf::DW_FORM_ref1: + case llvm::dwarf::DW_FORM_ref2: + case llvm::dwarf::DW_FORM_ref4: + case llvm::dwarf::DW_FORM_ref8: + case llvm::dwarf::DW_FORM_ref_udata: + case llvm::dwarf::DW_FORM_indirect: + case llvm::dwarf::DW_FORM_sec_offset: + case llvm::dwarf::DW_FORM_exprloc: + case llvm::dwarf::DW_FORM_flag_present: + case llvm::dwarf::DW_FORM_ref_sig8: + case llvm::dwarf::DW_FORM_GNU_str_index: + case llvm::dwarf::DW_FORM_GNU_addr_index: + case llvm::dwarf::DW_FORM_implicit_const: + return true; + default: + break; } return false; } Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -69,7 +69,8 @@ dw_offset_t GetTypeOffset() const { return m_type_offset; } uint64_t GetDWOId() const { return m_dwo_id; } bool IsTypeUnit() const { - return m_unit_type == DW_UT_type || m_unit_type == DW_UT_split_type; + return m_unit_type == llvm::dwarf::DW_UT_type || + m_unit_type == llvm::dwarf::DW_UT_split_type; } uint32_t GetNextUnitOffset() const { return m_offset + m_length + 4; } Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -108,12 +108,14 @@ else if (dwo_symbol_file->GetDWARFContext() .getOrLoadRngListsData() .GetByteSize() > 0) - dwo_cu->SetRangesBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32)); + dwo_cu->SetRangesBase( + llvm::DWARFListTableHeader::getHeaderSize(llvm::dwarf::DWARF32)); if (GetVersion() >= 5 && dwo_symbol_file->GetDWARFContext().getOrLoadLocListsData().GetByteSize() > 0) - dwo_cu->SetLoclistsBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32)); + dwo_cu->SetLoclistsBase( + llvm::DWARFListTableHeader::getHeaderSize(llvm::dwarf::DWARF32)); dwo_cu->SetBaseAddress(GetBaseAddress()); @@ -357,7 +359,7 @@ // Extract DW_AT_addr_base first, as other attributes may need it. for (size_t i = 0; i < num_attributes; ++i) { - if (attributes.AttributeAtIndex(i) != DW_AT_addr_base) + if (attributes.AttributeAtIndex(i) != llvm::dwarf::DW_AT_addr_base) continue; DWARFFormValue form_value; if (attributes.ExtractFormValueAtIndex(i, form_value)) { @@ -372,33 +374,33 @@ if (!attributes.ExtractFormValueAtIndex(i, form_value)) continue; switch (attr) { - case DW_AT_loclists_base: + case llvm::dwarf::DW_AT_loclists_base: SetLoclistsBase(form_value.Unsigned()); break; - case DW_AT_rnglists_base: + case llvm::dwarf::DW_AT_rnglists_base: SetRangesBase(form_value.Unsigned()); break; - case DW_AT_str_offsets_base: + case llvm::dwarf::DW_AT_str_offsets_base: SetStrOffsetsBase(form_value.Unsigned()); break; - case DW_AT_low_pc: + case llvm::dwarf::DW_AT_low_pc: SetBaseAddress(form_value.Address()); break; - case DW_AT_entry_pc: + case llvm::dwarf::DW_AT_entry_pc: // If the value was already set by DW_AT_low_pc, don't update it. if (m_base_addr == LLDB_INVALID_ADDRESS) SetBaseAddress(form_value.Address()); break; - case DW_AT_stmt_list: + case llvm::dwarf::DW_AT_stmt_list: m_line_table_offset = form_value.Unsigned(); break; - case DW_AT_GNU_addr_base: + case llvm::dwarf::DW_AT_GNU_addr_base: m_gnu_addr_base = form_value.Unsigned(); break; - case DW_AT_GNU_ranges_base: + case llvm::dwarf::DW_AT_GNU_ranges_base: m_gnu_ranges_base = form_value.Unsigned(); break; - case DW_AT_GNU_dwo_id: + case llvm::dwarf::DW_AT_GNU_dwo_id: m_dwo_id = form_value.Unsigned(); break; } @@ -435,7 +437,7 @@ template static llvm::Expected ParseListTableHeader(const llvm::DWARFDataExtractor &data, uint64_t offset, - DwarfFormat format) { + llvm::dwarf::DwarfFormat format) { // We are expected to be called with Offset 0 or pointing just past the table // header. Correct Offset in the latter case so that it points to the start // of the header. @@ -474,7 +476,8 @@ } m_loclists_base = loclists_base; - uint64_t header_size = llvm::DWARFListTableHeader::getHeaderSize(DWARF32); + uint64_t header_size = + llvm::DWARFListTableHeader::getHeaderSize(llvm::dwarf::DWARF32); if (loclists_base < header_size) return; @@ -545,7 +548,8 @@ m_rnglist_table_done = true; if (auto table_or_error = ParseListTableHeader( - GetRnglistData().GetAsLLVM(), m_ranges_base, DWARF32)) + GetRnglistData().GetAsLLVM(), m_ranges_base, + llvm::dwarf::DWARF32)) m_rnglist_table = std::move(table_or_error.get()); else GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( @@ -669,8 +673,8 @@ if (!die) return; - llvm::StringRef producer( - die->GetAttributeValueAsString(this, DW_AT_producer, nullptr)); + llvm::StringRef producer(die->GetAttributeValueAsString( + this, llvm::dwarf::DW_AT_producer, nullptr)); if (producer.empty()) return; @@ -718,7 +722,8 @@ if (!die) m_language_type = 0; else - m_language_type = die->GetAttributeValueAsUnsigned(this, DW_AT_language, 0); + m_language_type = + die->GetAttributeValueAsUnsigned(this, llvm::dwarf::DW_AT_language, 0); return *m_language_type; } @@ -727,8 +732,8 @@ const DWARFDebugInfoEntry *die = GetUnitDIEPtrOnly(); if (die) { m_is_optimized = eLazyBoolNo; - if (die->GetAttributeValueAsUnsigned(this, DW_AT_APPLE_optimized, 0) == - 1) { + if (die->GetAttributeValueAsUnsigned( + this, llvm::dwarf::DW_AT_APPLE_optimized, 0) == 1) { m_is_optimized = eLazyBoolYes; } } @@ -784,8 +789,9 @@ if (!die) return; - llvm::StringRef comp_dir = removeHostnameFromPathname( - die->GetAttributeValueAsString(this, DW_AT_comp_dir, nullptr)); + llvm::StringRef comp_dir = + removeHostnameFromPathname(die->GetAttributeValueAsString( + this, llvm::dwarf::DW_AT_comp_dir, nullptr)); if (!comp_dir.empty()) { FileSpec::Style comp_dir_style = FileSpec::GuessPathStyle(comp_dir).getValueOr(FileSpec::Style::native); @@ -794,7 +800,7 @@ // Try to detect the style based on the DW_AT_name attribute, but just store // the detected style in the m_comp_dir field. const char *name = - die->GetAttributeValueAsString(this, DW_AT_name, nullptr); + die->GetAttributeValueAsString(this, llvm::dwarf::DW_AT_name, nullptr); m_comp_dir = FileSpec( "", FileSpec::GuessPathStyle(name).getValueOr(FileSpec::Style::native)); } @@ -806,9 +812,9 @@ if (!die) return; - m_file_spec = - FileSpec(die->GetAttributeValueAsString(this, DW_AT_name, nullptr), - GetPathStyle()); + m_file_spec = FileSpec( + die->GetAttributeValueAsString(this, llvm::dwarf::DW_AT_name, nullptr), + GetPathStyle()); if (m_file_spec->IsRelative()) m_file_spec->MakeAbsolute(GetCompilationDirectory()); @@ -860,8 +866,9 @@ } else { header.m_abbr_offset = data.GetDWARFOffset(offset_ptr); header.m_addr_size = data.GetU8(offset_ptr); - header.m_unit_type = - section == DIERef::Section::DebugTypes ? DW_UT_type : DW_UT_compile; + header.m_unit_type = section == DIERef::Section::DebugTypes + ? llvm::dwarf::DW_UT_type + : llvm::dwarf::DW_UT_compile; } if (context.isDwo()) { Index: lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -87,7 +87,7 @@ ConstString basename, llvm::function_ref callback) { for (const DebugNames::Entry &entry : m_debug_names_up->equal_range(basename.GetStringRef())) { - if (entry.tag() != DW_TAG_variable) + if (entry.tag() != llvm::dwarf::DW_TAG_variable) continue; if (!ProcessEntry(entry, callback, basename.GetStringRef())) @@ -108,7 +108,7 @@ uint64_t entry_offset = nte.getEntryOffset(); llvm::Expected entry_or = ni.getEntry(&entry_offset); for (; entry_or; entry_or = ni.getEntry(&entry_offset)) { - if (entry_or->tag() != DW_TAG_variable) + if (entry_or->tag() != llvm::dwarf::DW_TAG_variable) continue; if (!ProcessEntry(*entry_or, callback, @@ -132,7 +132,7 @@ uint64_t entry_offset = nte.getEntryOffset(); llvm::Expected entry_or = ni.getEntry(&entry_offset); for (; entry_or; entry_or = ni.getEntry(&entry_offset)) { - if (entry_or->tag() != DW_TAG_variable) + if (entry_or->tag() != llvm::dwarf::DW_TAG_variable) continue; if (entry_or->getCUOffset() != cu_offset) continue; @@ -160,8 +160,8 @@ for (const DebugNames::Entry &entry : m_debug_names_up->equal_range(class_name.GetStringRef())) { - if (entry.tag() != DW_TAG_structure_type && - entry.tag() != DW_TAG_class_type) + if (entry.tag() != llvm::dwarf::DW_TAG_structure_type && + entry.tag() != llvm::dwarf::DW_TAG_class_type) continue; llvm::Optional ref = ToDIERef(entry); @@ -180,7 +180,8 @@ continue; } - if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 0)) { + if (die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_APPLE_objc_complete_type, 0)) { // If we find the complete version we're done. callback(die); return; @@ -227,7 +228,7 @@ ConstString name, llvm::function_ref callback) { for (const DebugNames::Entry &entry : m_debug_names_up->equal_range(name.GetStringRef())) { - if (entry.tag() == DW_TAG_namespace) { + if (entry.tag() == llvm::dwarf::DW_TAG_namespace) { if (!ProcessEntry(entry, callback, name.GetStringRef())) return; } @@ -244,8 +245,9 @@ std::set seen; for (const DebugNames::Entry &entry : m_debug_names_up->equal_range(name.GetStringRef())) { - Tag tag = entry.tag(); - if (tag != DW_TAG_subprogram && tag != DW_TAG_inlined_subroutine) + llvm::dwarf::Tag tag = entry.tag(); + if (tag != llvm::dwarf::DW_TAG_subprogram && + tag != llvm::dwarf::DW_TAG_inlined_subroutine) continue; if (llvm::Optional ref = ToDIERef(entry)) { @@ -274,8 +276,9 @@ uint64_t entry_offset = nte.getEntryOffset(); llvm::Expected entry_or = ni.getEntry(&entry_offset); for (; entry_or; entry_or = ni.getEntry(&entry_offset)) { - Tag tag = entry_or->tag(); - if (tag != DW_TAG_subprogram && tag != DW_TAG_inlined_subroutine) + llvm::dwarf::Tag tag = entry_or->tag(); + if (tag != llvm::dwarf::DW_TAG_subprogram && + tag != llvm::dwarf::DW_TAG_inlined_subroutine) continue; if (!ProcessEntry(*entry_or, callback, Index: lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -32,8 +32,10 @@ const dw_tag_t die_tag = die_info_array[i].tag; bool tag_matches = die_tag == 0 || tag == die_tag; if (!tag_matches) { - if (die_tag == DW_TAG_class_type || die_tag == DW_TAG_structure_type) - tag_matches = tag == DW_TAG_structure_type || tag == DW_TAG_class_type; + if (die_tag == llvm::dwarf::DW_TAG_class_type || + die_tag == llvm::dwarf::DW_TAG_structure_type) + tag_matches = tag == llvm::dwarf::DW_TAG_structure_type || + tag == llvm::dwarf::DW_TAG_class_type; } if (tag_matches) { if (!callback(DIERef(die_info_array[i]))) @@ -58,8 +60,10 @@ const dw_tag_t die_tag = die_info_array[i].tag; bool tag_matches = die_tag == 0 || tag == die_tag; if (!tag_matches) { - if (die_tag == DW_TAG_class_type || die_tag == DW_TAG_structure_type) - tag_matches = tag == DW_TAG_structure_type || tag == DW_TAG_class_type; + if (die_tag == llvm::dwarf::DW_TAG_class_type || + die_tag == llvm::dwarf::DW_TAG_structure_type) + tag_matches = tag == llvm::dwarf::DW_TAG_structure_type || + tag == llvm::dwarf::DW_TAG_class_type; } if (tag_matches) { if (!callback(DIERef(die_info_array[i]))) @@ -75,8 +79,8 @@ const size_t count = die_info_array.size(); for (size_t i = 0; i < count; ++i) { const dw_tag_t die_tag = die_info_array[i].tag; - if (!(die_tag == 0 || die_tag == DW_TAG_class_type || - die_tag == DW_TAG_structure_type)) + if (!(die_tag == 0 || die_tag == llvm::dwarf::DW_TAG_class_type || + die_tag == llvm::dwarf::DW_TAG_structure_type)) continue; bool is_implementation = (die_info_array[i].type_flags & eTypeFlagClassIsImplementation) != 0; @@ -133,7 +137,7 @@ : die_base_offset(_die_base_offset), atoms() { // Define an array of DIE offsets by first defining an array, and then define // the atom type for the array, in this case we have an array of DIE offsets. - AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4); + AppendAtom(eAtomTypeDIEOffset, llvm::dwarf::DW_FORM_data4); } void DWARFMappedHash::Prologue::ClearAtoms() { @@ -156,51 +160,51 @@ atoms.push_back({type, form}); atom_mask |= 1u << type; switch (form) { - case DW_FORM_indirect: - case DW_FORM_exprloc: - case DW_FORM_flag_present: - case DW_FORM_ref_sig8: + case llvm::dwarf::DW_FORM_indirect: + case llvm::dwarf::DW_FORM_exprloc: + case llvm::dwarf::DW_FORM_flag_present: + case llvm::dwarf::DW_FORM_ref_sig8: llvm_unreachable("Unhandled atom form"); - case DW_FORM_addrx: - case DW_FORM_string: - case DW_FORM_block: - case DW_FORM_block1: - case DW_FORM_sdata: - case DW_FORM_udata: - case DW_FORM_ref_udata: - case DW_FORM_GNU_addr_index: - case DW_FORM_GNU_str_index: + case llvm::dwarf::DW_FORM_addrx: + case llvm::dwarf::DW_FORM_string: + case llvm::dwarf::DW_FORM_block: + case llvm::dwarf::DW_FORM_block1: + case llvm::dwarf::DW_FORM_sdata: + case llvm::dwarf::DW_FORM_udata: + case llvm::dwarf::DW_FORM_ref_udata: + case llvm::dwarf::DW_FORM_GNU_addr_index: + case llvm::dwarf::DW_FORM_GNU_str_index: hash_data_has_fixed_byte_size = false; LLVM_FALLTHROUGH; - case DW_FORM_flag: - case DW_FORM_data1: - case DW_FORM_ref1: - case DW_FORM_sec_offset: + case llvm::dwarf::DW_FORM_flag: + case llvm::dwarf::DW_FORM_data1: + case llvm::dwarf::DW_FORM_ref1: + case llvm::dwarf::DW_FORM_sec_offset: min_hash_data_byte_size += 1; break; - case DW_FORM_block2: + case llvm::dwarf::DW_FORM_block2: hash_data_has_fixed_byte_size = false; LLVM_FALLTHROUGH; - case DW_FORM_data2: - case DW_FORM_ref2: + case llvm::dwarf::DW_FORM_data2: + case llvm::dwarf::DW_FORM_ref2: min_hash_data_byte_size += 2; break; - case DW_FORM_block4: + case llvm::dwarf::DW_FORM_block4: hash_data_has_fixed_byte_size = false; LLVM_FALLTHROUGH; - case DW_FORM_data4: - case DW_FORM_ref4: - case DW_FORM_addr: - case DW_FORM_ref_addr: - case DW_FORM_strp: + case llvm::dwarf::DW_FORM_data4: + case llvm::dwarf::DW_FORM_ref4: + case llvm::dwarf::DW_FORM_addr: + case llvm::dwarf::DW_FORM_ref_addr: + case llvm::dwarf::DW_FORM_strp: min_hash_data_byte_size += 4; break; - case DW_FORM_data8: - case DW_FORM_ref8: + case llvm::dwarf::DW_FORM_data8: + case llvm::dwarf::DW_FORM_ref8: min_hash_data_byte_size += 8; break; } @@ -221,7 +225,7 @@ } // Hardcode to the only known value for now. - AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4); + AppendAtom(eAtomTypeDIEOffset, llvm::dwarf::DW_FORM_data4); } else { for (uint32_t i = 0; i < atom_count; ++i) { AtomType type = (AtomType)data.GetU16(&offset); Index: lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -169,21 +169,21 @@ const dw_tag_t tag = die.Tag(); switch (tag) { - case DW_TAG_array_type: - case DW_TAG_base_type: - case DW_TAG_class_type: - case DW_TAG_constant: - case DW_TAG_enumeration_type: - case DW_TAG_inlined_subroutine: - case DW_TAG_namespace: - case DW_TAG_string_type: - case DW_TAG_structure_type: - case DW_TAG_subprogram: - case DW_TAG_subroutine_type: - case DW_TAG_typedef: - case DW_TAG_union_type: - case DW_TAG_unspecified_type: - case DW_TAG_variable: + case llvm::dwarf::DW_TAG_array_type: + case llvm::dwarf::DW_TAG_base_type: + case llvm::dwarf::DW_TAG_class_type: + case llvm::dwarf::DW_TAG_constant: + case llvm::dwarf::DW_TAG_enumeration_type: + case llvm::dwarf::DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_namespace: + case llvm::dwarf::DW_TAG_string_type: + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_subroutine_type: + case llvm::dwarf::DW_TAG_typedef: + case llvm::dwarf::DW_TAG_union_type: + case llvm::dwarf::DW_TAG_unspecified_type: + case llvm::dwarf::DW_TAG_variable: break; default: @@ -206,40 +206,40 @@ dw_attr_t attr = attributes.AttributeAtIndex(i); DWARFFormValue form_value; switch (attr) { - case DW_AT_name: + case llvm::dwarf::DW_AT_name: if (attributes.ExtractFormValueAtIndex(i, form_value)) name = form_value.AsCString(); break; - case DW_AT_declaration: + case llvm::dwarf::DW_AT_declaration: if (attributes.ExtractFormValueAtIndex(i, form_value)) is_declaration = form_value.Unsigned() != 0; break; - case DW_AT_MIPS_linkage_name: - case DW_AT_linkage_name: + case llvm::dwarf::DW_AT_MIPS_linkage_name: + case llvm::dwarf::DW_AT_linkage_name: if (attributes.ExtractFormValueAtIndex(i, form_value)) mangled_cstr = form_value.AsCString(); break; - case DW_AT_low_pc: - case DW_AT_high_pc: - case DW_AT_ranges: + case llvm::dwarf::DW_AT_low_pc: + case llvm::dwarf::DW_AT_high_pc: + case llvm::dwarf::DW_AT_ranges: has_address = true; break; - case DW_AT_entry_pc: + case llvm::dwarf::DW_AT_entry_pc: has_address = true; break; - case DW_AT_location: - case DW_AT_const_value: + case llvm::dwarf::DW_AT_location: + case llvm::dwarf::DW_AT_const_value: has_location_or_const_value = true; is_global_or_static_variable = die.IsGlobalOrStaticScopeVariable(); break; - case DW_AT_specification: + case llvm::dwarf::DW_AT_specification: if (attributes.ExtractFormValueAtIndex(i, form_value)) specification_die_form = form_value; break; @@ -249,8 +249,8 @@ DIERef ref = *DWARFDIE(&unit, &die).GetDIERef(); switch (tag) { - case DW_TAG_inlined_subroutine: - case DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_subprogram: if (has_address) { if (name) { bool is_objc_method = false; @@ -304,29 +304,29 @@ } break; - case DW_TAG_array_type: - case DW_TAG_base_type: - case DW_TAG_class_type: - case DW_TAG_constant: - case DW_TAG_enumeration_type: - case DW_TAG_string_type: - case DW_TAG_structure_type: - case DW_TAG_subroutine_type: - case DW_TAG_typedef: - case DW_TAG_union_type: - case DW_TAG_unspecified_type: + case llvm::dwarf::DW_TAG_array_type: + case llvm::dwarf::DW_TAG_base_type: + case llvm::dwarf::DW_TAG_class_type: + case llvm::dwarf::DW_TAG_constant: + case llvm::dwarf::DW_TAG_enumeration_type: + case llvm::dwarf::DW_TAG_string_type: + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_subroutine_type: + case llvm::dwarf::DW_TAG_typedef: + case llvm::dwarf::DW_TAG_union_type: + case llvm::dwarf::DW_TAG_unspecified_type: if (name && !is_declaration) set.types.Insert(ConstString(name), ref); if (mangled_cstr && !is_declaration) set.types.Insert(ConstString(mangled_cstr), ref); break; - case DW_TAG_namespace: + case llvm::dwarf::DW_TAG_namespace: if (name) set.namespaces.Insert(ConstString(name), ref); break; - case DW_TAG_variable: + case llvm::dwarf::DW_TAG_variable: if (name && has_location_or_const_value && is_global_or_static_variable) { set.globals.Insert(ConstString(name), ref); // Be sure to include variables by their mangled and demangled names if Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -290,41 +290,41 @@ bool add_type = false; switch (tag) { - case DW_TAG_array_type: + case llvm::dwarf::DW_TAG_array_type: add_type = (type_mask & eTypeClassArray) != 0; break; - case DW_TAG_unspecified_type: - case DW_TAG_base_type: + case llvm::dwarf::DW_TAG_unspecified_type: + case llvm::dwarf::DW_TAG_base_type: add_type = (type_mask & eTypeClassBuiltin) != 0; break; - case DW_TAG_class_type: + case llvm::dwarf::DW_TAG_class_type: add_type = (type_mask & eTypeClassClass) != 0; break; - case DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_structure_type: add_type = (type_mask & eTypeClassStruct) != 0; break; - case DW_TAG_union_type: + case llvm::dwarf::DW_TAG_union_type: add_type = (type_mask & eTypeClassUnion) != 0; break; - case DW_TAG_enumeration_type: + case llvm::dwarf::DW_TAG_enumeration_type: add_type = (type_mask & eTypeClassEnumeration) != 0; break; - case DW_TAG_subroutine_type: - case DW_TAG_subprogram: - case DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_subroutine_type: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_inlined_subroutine: add_type = (type_mask & eTypeClassFunction) != 0; break; - case DW_TAG_pointer_type: + case llvm::dwarf::DW_TAG_pointer_type: add_type = (type_mask & eTypeClassPointer) != 0; break; - case DW_TAG_rvalue_reference_type: - case DW_TAG_reference_type: + case llvm::dwarf::DW_TAG_rvalue_reference_type: + case llvm::dwarf::DW_TAG_reference_type: add_type = (type_mask & eTypeClassReference) != 0; break; - case DW_TAG_typedef: + case llvm::dwarf::DW_TAG_typedef: add_type = (type_mask & eTypeClassTypedef) != 0; break; - case DW_TAG_ptr_to_member_type: + case llvm::dwarf::DW_TAG_ptr_to_member_type: add_type = (type_mask & eTypeClassMemberPointer) != 0; break; default: @@ -391,11 +391,11 @@ dw_tag_t tag = die.Tag(); switch (tag) { - case DW_TAG_compile_unit: - case DW_TAG_partial_unit: - case DW_TAG_subprogram: - case DW_TAG_inlined_subroutine: - case DW_TAG_lexical_block: + case llvm::dwarf::DW_TAG_compile_unit: + case llvm::dwarf::DW_TAG_partial_unit: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_lexical_block: return die; default: break; @@ -687,11 +687,11 @@ /// Return the DW_AT_(GNU_)dwo_name. static const char *GetDWOName(DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die) { - const char *dwo_name = - cu_die.GetAttributeValueAsString(&dwarf_cu, DW_AT_GNU_dwo_name, nullptr); + const char *dwo_name = cu_die.GetAttributeValueAsString( + &dwarf_cu, llvm::dwarf::DW_AT_GNU_dwo_name, nullptr); if (!dwo_name) - dwo_name = - cu_die.GetAttributeValueAsString(&dwarf_cu, DW_AT_dwo_name, nullptr); + dwo_name = cu_die.GetAttributeValueAsString( + &dwarf_cu, llvm::dwarf::DW_AT_dwo_name, nullptr); return dwo_name; } @@ -894,11 +894,12 @@ const DWARFBaseDIE cu_die = dwarf_cu->GetNonSkeletonUnit().GetUnitDIEOnly(); if (!cu_die) return {}; - const char *sdk = cu_die.GetAttributeValueAsString(DW_AT_APPLE_sdk, nullptr); + const char *sdk = + cu_die.GetAttributeValueAsString(llvm::dwarf::DW_AT_APPLE_sdk, nullptr); if (!sdk) return {}; const char *sysroot = - cu_die.GetAttributeValueAsString(DW_AT_LLVM_sysroot, ""); + cu_die.GetAttributeValueAsString(llvm::dwarf::DW_AT_LLVM_sysroot, ""); // Register the sysroot path remapping with the module belonging to // the CU as well as the one belonging to the symbol file. The two // would be different if this is an OSO object and module is the @@ -924,7 +925,7 @@ size_t functions_added = 0; dwarf_cu = &dwarf_cu->GetNonSkeletonUnit(); for (DWARFDebugInfoEntry &entry : dwarf_cu->dies()) { - if (entry.Tag() != DW_TAG_subprogram) + if (entry.Tag() != llvm::dwarf::DW_TAG_subprogram) continue; DWARFDIE die(dwarf_cu, &entry); @@ -1074,36 +1075,36 @@ return false; for (DWARFDIE child_die : die.children()) { - if (child_die.Tag() != DW_TAG_imported_declaration) + if (child_die.Tag() != llvm::dwarf::DW_TAG_imported_declaration) continue; - DWARFDIE module_die = child_die.GetReferencedDIE(DW_AT_import); - if (module_die.Tag() != DW_TAG_module) + DWARFDIE module_die = child_die.GetReferencedDIE(llvm::dwarf::DW_AT_import); + if (module_die.Tag() != llvm::dwarf::DW_TAG_module) continue; - if (const char *name = - module_die.GetAttributeValueAsString(DW_AT_name, nullptr)) { + if (const char *name = module_die.GetAttributeValueAsString( + llvm::dwarf::DW_AT_name, nullptr)) { SourceModule module; module.path.push_back(ConstString(name)); DWARFDIE parent_die = module_die; while ((parent_die = parent_die.GetParent())) { - if (parent_die.Tag() != DW_TAG_module) + if (parent_die.Tag() != llvm::dwarf::DW_TAG_module) break; - if (const char *name = - parent_die.GetAttributeValueAsString(DW_AT_name, nullptr)) + if (const char *name = parent_die.GetAttributeValueAsString( + llvm::dwarf::DW_AT_name, nullptr)) module.path.push_back(ConstString(name)); } std::reverse(module.path.begin(), module.path.end()); if (const char *include_path = module_die.GetAttributeValueAsString( - DW_AT_LLVM_include_path, nullptr)) { + llvm::dwarf::DW_AT_LLVM_include_path, nullptr)) { FileSpec include_spec(include_path, dwarf_cu->GetPathStyle()); MakeAbsoluteAndRemap(include_spec, *dwarf_cu, m_objfile_sp->GetModule()); module.search_path = ConstString(include_spec.GetPath()); } if (const char *sysroot = dwarf_cu->DIE().GetAttributeValueAsString( - DW_AT_LLVM_sysroot, nullptr)) + llvm::dwarf::DW_AT_LLVM_sysroot, nullptr)) module.sysroot = ConstString(sysroot); imported_modules.push_back(module); } @@ -1207,11 +1208,11 @@ if (!dwarf_cu_die) return false; - lldb::offset_t sect_offset = - dwarf_cu_die.GetAttributeValueAsUnsigned(DW_AT_macros, DW_INVALID_OFFSET); + lldb::offset_t sect_offset = dwarf_cu_die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_macros, DW_INVALID_OFFSET); if (sect_offset == DW_INVALID_OFFSET) - sect_offset = dwarf_cu_die.GetAttributeValueAsUnsigned(DW_AT_GNU_macros, - DW_INVALID_OFFSET); + sect_offset = dwarf_cu_die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_GNU_macros, DW_INVALID_OFFSET); if (sect_offset == DW_INVALID_OFFSET) return false; @@ -1229,11 +1230,11 @@ dw_tag_t tag = die.Tag(); switch (tag) { - case DW_TAG_inlined_subroutine: - case DW_TAG_subprogram: - case DW_TAG_lexical_block: { + case llvm::dwarf::DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_lexical_block: { Block *block = nullptr; - if (tag == DW_TAG_subprogram) { + if (tag == llvm::dwarf::DW_TAG_subprogram) { // Skip any DW_TAG_subprogram DIEs that are inside of a normal or // inlined functions. These will be parsed on their own as separate // entities. @@ -1260,10 +1261,10 @@ if (die.GetDIENamesAndRanges(name, mangled_name, ranges, decl_file, decl_line, decl_column, call_file, call_line, call_column, nullptr)) { - if (tag == DW_TAG_subprogram) { + if (tag == llvm::dwarf::DW_TAG_subprogram) { assert(subprogram_low_pc == LLDB_INVALID_ADDRESS); subprogram_low_pc = ranges.GetMinRangeBase(0); - } else if (tag == DW_TAG_inlined_subroutine) { + } else if (tag == llvm::dwarf::DW_TAG_inlined_subroutine) { // We get called here for inlined subroutines in two ways. The first // time is when we are making the Function object for this inlined // concrete instance. Since we're creating a top level block at @@ -1296,7 +1297,7 @@ } block->FinalizeRanges(); - if (tag != DW_TAG_subprogram && + if (tag != llvm::dwarf::DW_TAG_subprogram && (name != nullptr || mangled_name != nullptr)) { std::unique_ptr decl_up; if (decl_file != 0 || decl_line != 0 || decl_column != 0) @@ -1345,15 +1346,16 @@ dw_tag_t tag = die.Tag(); bool check_virtuality = false; switch (tag) { - case DW_TAG_inheritance: - case DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_inheritance: + case llvm::dwarf::DW_TAG_subprogram: check_virtuality = true; break; default: break; } if (check_virtuality) { - if (die.GetAttributeValueAsUnsigned(DW_AT_virtuality, 0) != 0) + if (die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_virtuality, 0) != + 0) return true; } } @@ -1502,9 +1504,9 @@ if (decl_ctx_die) { if (log) { switch (decl_ctx_die.Tag()) { - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_class_type: { + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_union_type: + case llvm::dwarf::DW_TAG_class_type: { // Get the type, which could be a forward declaration if (log) GetObjectFile()->GetModule()->LogMessage( @@ -1684,10 +1686,11 @@ /// FIXME: Technically 0 is a valid hash. static uint64_t GetDWOId(DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die) { - uint64_t dwo_id = - cu_die.GetAttributeValueAsUnsigned(&dwarf_cu, DW_AT_GNU_dwo_id, 0); + uint64_t dwo_id = cu_die.GetAttributeValueAsUnsigned( + &dwarf_cu, llvm::dwarf::DW_AT_GNU_dwo_id, 0); if (!dwo_id) - dwo_id = cu_die.GetAttributeValueAsUnsigned(&dwarf_cu, DW_AT_dwo_id, 0); + dwo_id = cu_die.GetAttributeValueAsUnsigned(&dwarf_cu, + llvm::dwarf::DW_AT_dwo_id, 0); return dwo_id; } @@ -1728,8 +1731,8 @@ FileSpec dwo_file(dwo_name); FileSystem::Instance().Resolve(dwo_file); if (dwo_file.IsRelative()) { - const char *comp_dir = - cu_die.GetAttributeValueAsString(dwarf_cu, DW_AT_comp_dir, nullptr); + const char *comp_dir = cu_die.GetAttributeValueAsString( + dwarf_cu, llvm::dwarf::DW_AT_comp_dir, nullptr); if (!comp_dir) return nullptr; @@ -1780,7 +1783,8 @@ if (!die || die.HasChildren() || !die.GetDIE()) continue; - const char *name = die.GetAttributeValueAsString(DW_AT_name, nullptr); + const char *name = + die.GetAttributeValueAsString(llvm::dwarf::DW_AT_name, nullptr); if (!name) continue; @@ -1797,7 +1801,7 @@ dwo_module_spec.GetFileSpec().SetFile(dwo_path, FileSpec::Style::native); if (dwo_module_spec.GetFileSpec().IsRelative()) { const char *comp_dir = - die.GetAttributeValueAsString(DW_AT_comp_dir, nullptr); + die.GetAttributeValueAsString(llvm::dwarf::DW_AT_comp_dir, nullptr); if (comp_dir) { dwo_module_spec.GetFileSpec().SetFile(comp_dir, FileSpec::Style::native); @@ -2156,7 +2160,7 @@ sc.module_sp = m_objfile_sp->GetModule(); assert(sc.module_sp); - if (die.Tag() != DW_TAG_variable) + if (die.Tag() != llvm::dwarf::DW_TAG_variable) return true; auto *dwarf_cu = llvm::dyn_cast(die.GetCU()); @@ -2242,26 +2246,27 @@ return false; // If we were passed a die that is not a function, just return false... - if (!(orig_die.Tag() == DW_TAG_subprogram || - (include_inlines && orig_die.Tag() == DW_TAG_inlined_subroutine))) + if (!(orig_die.Tag() == llvm::dwarf::DW_TAG_subprogram || + (include_inlines && + orig_die.Tag() == llvm::dwarf::DW_TAG_inlined_subroutine))) return false; DWARFDIE die = orig_die; DWARFDIE inlined_die; - if (die.Tag() == DW_TAG_inlined_subroutine) { + if (die.Tag() == llvm::dwarf::DW_TAG_inlined_subroutine) { inlined_die = die; while (true) { die = die.GetParent(); if (die) { - if (die.Tag() == DW_TAG_subprogram) + if (die.Tag() == llvm::dwarf::DW_TAG_subprogram) break; } else break; } } - assert(die && die.Tag() == DW_TAG_subprogram); + assert(die && die.Tag() == llvm::dwarf::DW_TAG_subprogram); if (GetFunction(die, sc)) { Address addr; // Parse all blocks if needed @@ -2582,7 +2587,7 @@ SymbolContext sc(scope); const DWARFDebugInfoEntry *parent_die = die.GetParent().GetDIE(); while (parent_die != nullptr) { - if (parent_die->Tag() == DW_TAG_subprogram) + if (parent_die->Tag() == llvm::dwarf::DW_TAG_subprogram) break; parent_die = parent_die->GetParent(); } @@ -2611,17 +2616,18 @@ // context to be our decl context... if (orig_die != die) { switch (die.Tag()) { - case DW_TAG_compile_unit: - case DW_TAG_partial_unit: - case DW_TAG_namespace: - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_class_type: - case DW_TAG_lexical_block: - case DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_compile_unit: + case llvm::dwarf::DW_TAG_partial_unit: + case llvm::dwarf::DW_TAG_namespace: + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_union_type: + case llvm::dwarf::DW_TAG_class_type: + case llvm::dwarf::DW_TAG_lexical_block: + case llvm::dwarf::DW_TAG_subprogram: return die; - case DW_TAG_inlined_subroutine: { - DWARFDIE abs_die = die.GetReferencedDIE(DW_AT_abstract_origin); + case llvm::dwarf::DW_TAG_inlined_subroutine: { + DWARFDIE abs_die = + die.GetReferencedDIE(llvm::dwarf::DW_AT_abstract_origin); if (abs_die) { return abs_die; } @@ -2632,14 +2638,16 @@ } } - DWARFDIE spec_die = die.GetReferencedDIE(DW_AT_specification); + DWARFDIE spec_die = + die.GetReferencedDIE(llvm::dwarf::DW_AT_specification); if (spec_die) { DWARFDIE decl_ctx_die = GetDeclContextDIEContainingDIE(spec_die); if (decl_ctx_die) return decl_ctx_die; } - DWARFDIE abs_die = die.GetReferencedDIE(DW_AT_abstract_origin); + DWARFDIE abs_die = + die.GetReferencedDIE(llvm::dwarf::DW_AT_abstract_origin); if (abs_die) { DWARFDIE decl_ctx_die = GetDeclContextDIEContainingDIE(abs_die); if (decl_ctx_die) @@ -2714,8 +2722,8 @@ // itself! if (type_die != die) { switch (type_die.Tag()) { - case DW_TAG_class_type: - case DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_class_type: + case llvm::dwarf::DW_TAG_structure_type: try_resolving_type = true; break; default: @@ -2728,7 +2736,7 @@ if (must_be_implementation && type_die.Supports_DW_AT_APPLE_objc_complete_type()) try_resolving_type = type_die.GetAttributeValueAsUnsigned( - DW_AT_APPLE_objc_complete_type, 0); + llvm::dwarf::DW_AT_APPLE_objc_complete_type, 0); if (!try_resolving_type) return true; @@ -2809,7 +2817,8 @@ // function. dw_tag_t cu_tag = decl_ctx_1[count1 - 1].Tag(); UNUSED_IF_ASSERT_DISABLED(cu_tag); - assert(cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit); + assert(cu_tag == llvm::dwarf::DW_TAG_compile_unit || + cu_tag == llvm::dwarf::DW_TAG_partial_unit); #endif // Always skip the compile unit when comparing by only iterating up to "count @@ -2897,15 +2906,15 @@ // declaration for a struct and ("struct foo") ends up being a // class ("class foo { ... };") or vice versa. switch (type_tag) { - case DW_TAG_class_type: + case llvm::dwarf::DW_TAG_class_type: // We had a "class foo", see if we ended up with a "struct foo // { ... };" - try_resolving_type = (tag == DW_TAG_structure_type); + try_resolving_type = (tag == llvm::dwarf::DW_TAG_structure_type); break; - case DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_structure_type: // We had a "struct foo", see if we ended up with a "class foo // { ... };" - try_resolving_type = (tag == DW_TAG_class_type); + try_resolving_type = (tag == llvm::dwarf::DW_TAG_class_type); break; default: // Tags don't match, don't event try to resolve using this type @@ -2979,7 +2988,7 @@ if (type_sp) { GetTypeList().Insert(type_sp); - if (die.Tag() == DW_TAG_subprogram) { + if (die.Tag() == llvm::dwarf::DW_TAG_subprogram) { std::string scope_qualified_name(GetDeclContextForUID(die.GetID()) .GetScopeQualifiedName() .AsCString("")); @@ -3003,19 +3012,19 @@ const dw_tag_t tag = die.Tag(); bool type_is_new = false; - Tag dwarf_tag = static_cast(tag); + llvm::dwarf::Tag dwarf_tag = static_cast(tag); // TODO: Currently ParseTypeFromDWARF(...) which is called by ParseType(...) // does not handle DW_TAG_subrange_type. It is not clear if this is a bug or // not. - if (isType(dwarf_tag) && tag != DW_TAG_subrange_type) + if (isType(dwarf_tag) && tag != llvm::dwarf::DW_TAG_subrange_type) ParseType(sc, die, &type_is_new); if (type_is_new) ++types_added; if (parse_children && die.HasChildren()) { - if (die.Tag() == DW_TAG_subprogram) { + if (die.Tag() == llvm::dwarf::DW_TAG_subprogram) { SymbolContext child_sc(sc); child_sc.function = sc.comp_unit->FindFunctionByUID(die.GetID()).get(); types_added += ParseTypes(child_sc, die.GetFirstChild(), true, true); @@ -3130,7 +3139,8 @@ var_sp = ParseVariableDIE(sc, die, LLDB_INVALID_ADDRESS); if (var_sp) { die_to_variable[die.GetDIE()] = var_sp; - if (DWARFDIE spec_die = die.GetReferencedDIE(DW_AT_specification)) + if (DWARFDIE spec_die = + die.GetReferencedDIE(llvm::dwarf::DW_AT_specification)) die_to_variable[spec_die.GetDIE()] = var_sp; } return var_sp; @@ -3148,8 +3158,9 @@ const dw_tag_t tag = die.Tag(); ModuleSP module = GetObjectFile()->GetModule(); - if (tag != DW_TAG_variable && tag != DW_TAG_constant && - (tag != DW_TAG_formal_parameter || !sc.function)) + if (tag != llvm::dwarf::DW_TAG_variable && + tag != llvm::dwarf::DW_TAG_constant && + (tag != llvm::dwarf::DW_TAG_formal_parameter || !sc.function)) return nullptr; DWARFAttributes attributes; @@ -3171,50 +3182,50 @@ if (!attributes.ExtractFormValueAtIndex(i, form_value)) continue; switch (attr) { - case DW_AT_decl_file: + case llvm::dwarf::DW_AT_decl_file: decl.SetFile( attributes.CompileUnitAtIndex(i)->GetFile(form_value.Unsigned())); break; - case DW_AT_decl_line: + case llvm::dwarf::DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; - case DW_AT_decl_column: + case llvm::dwarf::DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; - case DW_AT_name: + case llvm::dwarf::DW_AT_name: name = form_value.AsCString(); break; - case DW_AT_linkage_name: - case DW_AT_MIPS_linkage_name: + case llvm::dwarf::DW_AT_linkage_name: + case llvm::dwarf::DW_AT_MIPS_linkage_name: mangled = form_value.AsCString(); break; - case DW_AT_type: + case llvm::dwarf::DW_AT_type: type_die_form = form_value; break; - case DW_AT_external: + case llvm::dwarf::DW_AT_external: is_external = form_value.Boolean(); break; - case DW_AT_const_value: + case llvm::dwarf::DW_AT_const_value: const_value_form = form_value; break; - case DW_AT_location: + case llvm::dwarf::DW_AT_location: location_form = form_value; break; - case DW_AT_start_scope: + case llvm::dwarf::DW_AT_start_scope: // TODO: Implement this. break; - case DW_AT_artificial: + case llvm::dwarf::DW_AT_artificial: is_artificial = form_value.Boolean(); break; - case DW_AT_declaration: - case DW_AT_description: - case DW_AT_endianity: - case DW_AT_segment: - case DW_AT_specification: - case DW_AT_visibility: + case llvm::dwarf::DW_AT_declaration: + case llvm::dwarf::DW_AT_description: + case llvm::dwarf::DW_AT_endianity: + case llvm::dwarf::DW_AT_segment: + case llvm::dwarf::DW_AT_specification: + case llvm::dwarf::DW_AT_visibility: default: - case DW_AT_abstract_origin: - case DW_AT_sibling: + case llvm::dwarf::DW_AT_abstract_origin: + case llvm::dwarf::DW_AT_sibling: break; } } @@ -3238,7 +3249,7 @@ } else { DataExtractor data = die.GetCU()->GetLocationData(); dw_offset_t offset = location_form.Unsigned(); - if (location_form.Form() == DW_FORM_loclistx) + if (location_form.Form() == llvm::dwarf::DW_FORM_loclistx) offset = die.GetCU()->GetLoclistOffset(offset).getValueOr(-1); if (data.ValidOffset(offset)) { data = DataExtractor(data, offset, data.GetByteSize() - offset); @@ -3279,10 +3290,11 @@ const DWARFDIE parent_context_die = GetDeclContextDIEContainingDIE(die); const DWARFDIE sc_parent_die = GetParentSymbolContextDIE(die); const dw_tag_t parent_tag = sc_parent_die.Tag(); - bool is_static_member = (parent_tag == DW_TAG_compile_unit || - parent_tag == DW_TAG_partial_unit) && - (parent_context_die.Tag() == DW_TAG_class_type || - parent_context_die.Tag() == DW_TAG_structure_type); + bool is_static_member = + (parent_tag == llvm::dwarf::DW_TAG_compile_unit || + parent_tag == llvm::dwarf::DW_TAG_partial_unit) && + (parent_context_die.Tag() == llvm::dwarf::DW_TAG_class_type || + parent_context_die.Tag() == llvm::dwarf::DW_TAG_structure_type); ValueType scope = eValueTypeInvalid; SymbolContextScope *symbol_context_scope = nullptr; @@ -3299,14 +3311,14 @@ // If the compiler does not emit a linkage name, we should be // able to generate a fully qualified name from the // declaration context. - if ((parent_tag == DW_TAG_compile_unit || - parent_tag == DW_TAG_partial_unit) && + if ((parent_tag == llvm::dwarf::DW_TAG_compile_unit || + parent_tag == llvm::dwarf::DW_TAG_partial_unit) && Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU()))) mangled = GetDWARFDeclContext(die).GetQualifiedNameAsConstString().GetCString(); } - if (tag == DW_TAG_formal_parameter) + if (tag == llvm::dwarf::DW_TAG_formal_parameter) scope = eValueTypeVariableArgument; else { // DWARF doesn't specify if a DW_TAG_variable is a local, global @@ -3431,9 +3443,9 @@ if (symbol_context_scope == nullptr) { switch (parent_tag) { - case DW_TAG_subprogram: - case DW_TAG_inlined_subroutine: - case DW_TAG_lexical_block: + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_lexical_block: if (sc.function) { symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(sc_parent_die.GetID()); @@ -3484,15 +3496,15 @@ const DWARFDIE &die, dw_offset_t spec_block_die_offset) { if (die) { switch (die.Tag()) { - case DW_TAG_subprogram: - case DW_TAG_inlined_subroutine: - case DW_TAG_lexical_block: { - if (die.GetReferencedDIE(DW_AT_specification).GetOffset() == + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_lexical_block: { + if (die.GetReferencedDIE(llvm::dwarf::DW_AT_specification).GetOffset() == spec_block_die_offset) return die; - if (die.GetReferencedDIE(DW_AT_abstract_origin).GetOffset() == - spec_block_die_offset) + if (die.GetReferencedDIE(llvm::dwarf::DW_AT_abstract_origin) + .GetOffset() == spec_block_die_offset) return die; } break; default: @@ -3520,7 +3532,8 @@ return; dw_tag_t tag = die.Tag(); - if (tag != DW_TAG_variable && tag != DW_TAG_constant) + if (tag != llvm::dwarf::DW_TAG_variable && + tag != llvm::dwarf::DW_TAG_constant) return; // Check to see if we have already parsed this variable or constant? @@ -3537,8 +3550,8 @@ DWARFDIE sc_parent_die = GetParentSymbolContextDIE(die); dw_tag_t parent_tag = sc_parent_die.Tag(); switch (parent_tag) { - case DW_TAG_compile_unit: - case DW_TAG_partial_unit: + case llvm::dwarf::DW_TAG_compile_unit: + case llvm::dwarf::DW_TAG_partial_unit: if (sc.comp_unit != nullptr) { variable_list_sp = sc.comp_unit->GetVariableList(false); } else { @@ -3581,13 +3594,14 @@ // and merge with the concrete parameters. // Nothing to merge if the block is not an inlined function. - if (block_die.Tag() != DW_TAG_inlined_subroutine) { + if (block_die.Tag() != llvm::dwarf::DW_TAG_inlined_subroutine) { return std::move(variable_dies); } // Nothing to merge if the block does not have abstract parameters. - DWARFDIE abs_die = block_die.GetReferencedDIE(DW_AT_abstract_origin); - if (!abs_die || abs_die.Tag() != DW_TAG_subprogram || + DWARFDIE abs_die = + block_die.GetReferencedDIE(llvm::dwarf::DW_AT_abstract_origin); + if (!abs_die || abs_die.Tag() != llvm::dwarf::DW_TAG_subprogram || !abs_die.HasChildren()) { return std::move(variable_dies); } @@ -3599,9 +3613,9 @@ DIEArray merged; bool did_merge_abstract = false; for (; abstract_child; abstract_child = abstract_child.GetSibling()) { - if (abstract_child.Tag() == DW_TAG_formal_parameter) { + if (abstract_child.Tag() == llvm::dwarf::DW_TAG_formal_parameter) { if (concrete_it == variable_dies.end() || - GetDIE(*concrete_it).Tag() != DW_TAG_formal_parameter) { + GetDIE(*concrete_it).Tag() != llvm::dwarf::DW_TAG_formal_parameter) { // We arrived at the end of the concrete parameter list, so all // the remaining abstract parameters must have been omitted. // Let us insert them to the merged list here. @@ -3611,7 +3625,8 @@ } DWARFDIE origin_of_concrete = - GetDIE(*concrete_it).GetReferencedDIE(DW_AT_abstract_origin); + GetDIE(*concrete_it) + .GetReferencedDIE(llvm::dwarf::DW_AT_abstract_origin); if (origin_of_concrete == abstract_child) { // The current abstract parameter is the origin of the current // concrete parameter, just push the concrete parameter. @@ -3636,7 +3651,7 @@ // formal parameters. If that's the case, then just bailout from the merge - // the variable list is malformed. for (; concrete_it != variable_dies.end(); ++concrete_it) { - if (GetDIE(*concrete_it).Tag() == DW_TAG_formal_parameter) { + if (GetDIE(*concrete_it).Tag() == llvm::dwarf::DW_TAG_formal_parameter) { return std::move(variable_dies); } merged.push_back(*concrete_it); @@ -3668,15 +3683,16 @@ size_t vars_added = 0; dw_tag_t tag = die.Tag(); - if ((tag == DW_TAG_variable) || (tag == DW_TAG_constant) || - (tag == DW_TAG_formal_parameter)) { + if ((tag == llvm::dwarf::DW_TAG_variable) || + (tag == llvm::dwarf::DW_TAG_constant) || + (tag == llvm::dwarf::DW_TAG_formal_parameter)) { accumulator.push_back(*die.GetDIERef()); } switch (tag) { - case DW_TAG_subprogram: - case DW_TAG_inlined_subroutine: - case DW_TAG_lexical_block: { + case llvm::dwarf::DW_TAG_subprogram: + case llvm::dwarf::DW_TAG_inlined_subroutine: + case llvm::dwarf::DW_TAG_lexical_block: { // If we start a new block, compute a new block variable list and recurse. Block *block = sc.function->GetBlock(/*can_create=*/true).FindBlockByID(die.GetID()); @@ -3746,8 +3762,8 @@ CollectCallSiteParameters(ModuleSP module, DWARFDIE call_site_die) { CallSiteParameterArray parameters; for (DWARFDIE child : call_site_die.children()) { - if (child.Tag() != DW_TAG_call_site_parameter && - child.Tag() != DW_TAG_GNU_call_site_parameter) + if (child.Tag() != llvm::dwarf::DW_TAG_call_site_parameter && + child.Tag() != llvm::dwarf::DW_TAG_GNU_call_site_parameter) continue; llvm::Optional LocationInCallee; @@ -3775,9 +3791,10 @@ for (size_t i = 0; i < num_attributes; ++i) { dw_attr_t attr = attributes.AttributeAtIndex(i); - if (attr == DW_AT_location) + if (attr == llvm::dwarf::DW_AT_location) LocationInCallee = parse_simple_location(i); - if (attr == DW_AT_call_value || attr == DW_AT_GNU_call_site_value) + if (attr == llvm::dwarf::DW_AT_call_value || + attr == llvm::dwarf::DW_AT_GNU_call_site_value) LocationInCaller = parse_simple_location(i); } @@ -3794,9 +3811,10 @@ SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) { // Check if the function has a supported call site-related attribute. // TODO: In the future it may be worthwhile to support call_all_source_calls. - bool has_call_edges = - function_die.GetAttributeValueAsUnsigned(DW_AT_call_all_calls, 0) || - function_die.GetAttributeValueAsUnsigned(DW_AT_GNU_all_call_sites, 0); + bool has_call_edges = function_die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_call_all_calls, 0) || + function_die.GetAttributeValueAsUnsigned( + llvm::dwarf::DW_AT_GNU_all_call_sites, 0); if (!has_call_edges) return {}; @@ -3811,7 +3829,8 @@ // (this is the kind of DWARF LLVM produces) and parse them eagerly. std::vector> call_edges; for (DWARFDIE child : function_die.children()) { - if (child.Tag() != DW_TAG_call_site && child.Tag() != DW_TAG_GNU_call_site) + if (child.Tag() != llvm::dwarf::DW_TAG_call_site && + child.Tag() != llvm::dwarf::DW_TAG_GNU_call_site) continue; llvm::Optional call_origin; @@ -3836,11 +3855,13 @@ dw_attr_t attr = attributes.AttributeAtIndex(i); - if (attr == DW_AT_call_tail_call || attr == DW_AT_GNU_tail_call) + if (attr == llvm::dwarf::DW_AT_call_tail_call || + attr == llvm::dwarf::DW_AT_GNU_tail_call) tail_call = form_value.Boolean(); // Extract DW_AT_call_origin (the call target's DIE). - if (attr == DW_AT_call_origin || attr == DW_AT_abstract_origin) { + if (attr == llvm::dwarf::DW_AT_call_origin || + attr == llvm::dwarf::DW_AT_abstract_origin) { call_origin = form_value.Reference(); if (!call_origin->IsValid()) { LLDB_LOG(log, "CollectCallEdges: Invalid call origin in {0}", @@ -3849,24 +3870,25 @@ } } - if (attr == DW_AT_low_pc) + if (attr == llvm::dwarf::DW_AT_low_pc) low_pc = form_value.Address(); // Extract DW_AT_call_return_pc (the PC the call returns to) if it's // available. It should only ever be unavailable for tail call edges, in // which case use LLDB_INVALID_ADDRESS. - if (attr == DW_AT_call_return_pc) + if (attr == llvm::dwarf::DW_AT_call_return_pc) return_pc = form_value.Address(); // Extract DW_AT_call_pc (the PC at the call/branch instruction). It // should only ever be unavailable for non-tail calls, in which case use // LLDB_INVALID_ADDRESS. - if (attr == DW_AT_call_pc) + if (attr == llvm::dwarf::DW_AT_call_pc) call_inst_pc = form_value.Address(); // Extract DW_AT_call_target (the location of the address of the indirect // call). - if (attr == DW_AT_call_target || attr == DW_AT_GNU_call_site_target) { + if (attr == llvm::dwarf::DW_AT_call_target || + attr == llvm::dwarf::DW_AT_GNU_call_site_target) { if (!DWARFFormValue::IsBlockForm(form_value.Form())) { LLDB_LOG(log, "CollectCallEdges: AT_call_target does not have block form"); @@ -4063,9 +4085,9 @@ // Note: user languages between lo_user and hi_user must be handled // explicitly here. switch (val) { - case DW_LANG_Mips_Assembler: + case llvm::dwarf::DW_LANG_Mips_Assembler: return eLanguageTypeMipsAssembler; - case DW_LANG_GOOGLE_RenderScript: + case llvm::dwarf::DW_LANG_GOOGLE_RenderScript: return eLanguageTypeExtRenderScript; default: return static_cast(val); @@ -4079,7 +4101,7 @@ LanguageType SymbolFileDWARF::GetLanguageFamily(DWARFUnit &unit) { auto lang = (llvm::dwarf::SourceLanguage)unit.GetDWARFLanguageType(); if (llvm::dwarf::isCPlusPlus(lang)) - lang = DW_LANG_C_plus_plus; + lang = llvm::dwarf::DW_LANG_C_plus_plus; return LanguageTypeFromDWARF(lang); } Index: lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp @@ -33,10 +33,10 @@ const dw_tag_t parent_pos_tag = parent_pos_die.Tag(); if (parent_arg_tag == parent_pos_tag) { switch (parent_arg_tag) { - case DW_TAG_class_type: - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_namespace: { + case llvm::dwarf::DW_TAG_class_type: + case llvm::dwarf::DW_TAG_structure_type: + case llvm::dwarf::DW_TAG_union_type: + case llvm::dwarf::DW_TAG_namespace: { const char *parent_arg_die_name = parent_arg_die.GetName(); if (parent_arg_die_name == nullptr) // Anonymous (i.e. no-name) struct @@ -51,8 +51,8 @@ } } break; - case DW_TAG_compile_unit: - case DW_TAG_partial_unit: + case llvm::dwarf::DW_TAG_compile_unit: + case llvm::dwarf::DW_TAG_partial_unit: done = true; break; default: Index: lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp +++ lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp @@ -84,7 +84,7 @@ switch (symbol.getLocationType()) { case PDB_LocType::Static: case PDB_LocType::TLS: { - stream.PutHex8(DW_OP_addr); + stream.PutHex8(llvm::dwarf::DW_OP_addr); SectionList *section_list = module->GetSectionList(); if (!section_list) @@ -112,9 +112,9 @@ if (EmitVFrameEvaluationDWARFExpression(fd->getProgram(), arch_type, stream)) { int32_t offset = symbol.getOffset(); - stream.PutHex8(DW_OP_consts); + stream.PutHex8(llvm::dwarf::DW_OP_consts); stream.PutSLEB128(offset); - stream.PutHex8(DW_OP_plus); + stream.PutHex8(llvm::dwarf::DW_OP_plus); register_kind = eRegisterKindLLDB; @@ -133,10 +133,10 @@ } if (reg_num > 31) { - stream.PutHex8(DW_OP_bregx); + stream.PutHex8(llvm::dwarf::DW_OP_bregx); stream.PutULEB128(reg_num); } else - stream.PutHex8(DW_OP_breg0 + reg_num); + stream.PutHex8(llvm::dwarf::DW_OP_breg0 + reg_num); int32_t offset = symbol.getOffset(); stream.PutSLEB128(offset); @@ -152,10 +152,10 @@ return DWARFExpression(); if (reg_num > 31) { - stream.PutHex8(DW_OP_regx); + stream.PutHex8(llvm::dwarf::DW_OP_regx); stream.PutULEB128(reg_num); } else - stream.PutHex8(DW_OP_reg0 + reg_num); + stream.PutHex8(llvm::dwarf::DW_OP_reg0 + reg_num); is_constant = false; Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp =================================================================== --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -943,12 +943,12 @@ default: break; - case DW_ATE_address: + case llvm::dwarf::DW_ATE_address: if (QualTypeMatchesBitSize(bit_size, ast, ast.VoidPtrTy)) return GetType(ast.VoidPtrTy); break; - case DW_ATE_boolean: + case llvm::dwarf::DW_ATE_boolean: if (QualTypeMatchesBitSize(bit_size, ast, ast.BoolTy)) return GetType(ast.BoolTy); if (QualTypeMatchesBitSize(bit_size, ast, ast.UnsignedCharTy)) @@ -959,18 +959,18 @@ return GetType(ast.UnsignedIntTy); break; - case DW_ATE_lo_user: + case llvm::dwarf::DW_ATE_lo_user: // This has been seen to mean DW_AT_complex_integer if (type_name.contains("complex")) { CompilerType complex_int_clang_type = - GetBuiltinTypeForDWARFEncodingAndBitSize("int", DW_ATE_signed, - bit_size / 2); + GetBuiltinTypeForDWARFEncodingAndBitSize( + "int", llvm::dwarf::DW_ATE_signed, bit_size / 2); return GetType( ast.getComplexType(ClangUtil::GetQualType(complex_int_clang_type))); } break; - case DW_ATE_complex_float: { + case llvm::dwarf::DW_ATE_complex_float: { CanQualType FloatComplexTy = ast.getComplexType(ast.FloatTy); if (QualTypeMatchesBitSize(bit_size, ast, FloatComplexTy)) return GetType(FloatComplexTy); @@ -984,13 +984,13 @@ return GetType(LongDoubleComplexTy); CompilerType complex_float_clang_type = - GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float, - bit_size / 2); + GetBuiltinTypeForDWARFEncodingAndBitSize( + "float", llvm::dwarf::DW_ATE_float, bit_size / 2); return GetType( ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type))); } - case DW_ATE_float: + case llvm::dwarf::DW_ATE_float: if (type_name == "float" && QualTypeMatchesBitSize(bit_size, ast, ast.FloatTy)) return GetType(ast.FloatTy); @@ -1011,7 +1011,7 @@ return GetType(ast.HalfTy); break; - case DW_ATE_signed: + case llvm::dwarf::DW_ATE_signed: if (!type_name.empty()) { if (type_name == "wchar_t" && QualTypeMatchesBitSize(bit_size, ast, ast.WCharTy) && @@ -1058,7 +1058,7 @@ return GetType(ast.Int128Ty); break; - case DW_ATE_signed_char: + case llvm::dwarf::DW_ATE_signed_char: if (ast.getLangOpts().CharIsSigned && type_name == "char") { if (QualTypeMatchesBitSize(bit_size, ast, ast.CharTy)) return GetType(ast.CharTy); @@ -1067,7 +1067,7 @@ return GetType(ast.SignedCharTy); break; - case DW_ATE_unsigned: + case llvm::dwarf::DW_ATE_unsigned: if (!type_name.empty()) { if (type_name == "wchar_t") { if (QualTypeMatchesBitSize(bit_size, ast, ast.WCharTy)) { @@ -1110,7 +1110,7 @@ return GetType(ast.UnsignedInt128Ty); break; - case DW_ATE_unsigned_char: + case llvm::dwarf::DW_ATE_unsigned_char: if (!ast.getLangOpts().CharIsSigned && type_name == "char") { if (QualTypeMatchesBitSize(bit_size, ast, ast.CharTy)) return GetType(ast.CharTy); @@ -1121,10 +1121,10 @@ return GetType(ast.UnsignedShortTy); break; - case DW_ATE_imaginary_float: + case llvm::dwarf::DW_ATE_imaginary_float: break; - case DW_ATE_UTF: + case llvm::dwarf::DW_ATE_UTF: switch (bit_size) { case 8: return GetType(ast.Char8Ty); @@ -7868,7 +7868,7 @@ clang::IdentifierInfo *setter_ident = &clang_ast.Idents.get(property_setter_no_colon); setter_sel = clang_ast.Selectors.getSelector(1, &setter_ident); - } else if (!(property_attributes & DW_APPLE_PROPERTY_readonly)) { + } else if (!(property_attributes & llvm::dwarf::DW_APPLE_PROPERTY_readonly)) { std::string setter_sel_string("set"); setter_sel_string.push_back(::toupper(property_name[0])); setter_sel_string.append(&property_name[1]); @@ -7893,17 +7893,17 @@ if (ivar_decl) property_decl->setPropertyIvarDecl(ivar_decl); - if (property_attributes & DW_APPLE_PROPERTY_readonly) + if (property_attributes & llvm::dwarf::DW_APPLE_PROPERTY_readonly) property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_readonly); - if (property_attributes & DW_APPLE_PROPERTY_readwrite) + if (property_attributes & llvm::dwarf::DW_APPLE_PROPERTY_readwrite) property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_readwrite); - if (property_attributes & DW_APPLE_PROPERTY_assign) + if (property_attributes & llvm::dwarf::DW_APPLE_PROPERTY_assign) property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_assign); - if (property_attributes & DW_APPLE_PROPERTY_retain) + if (property_attributes & llvm::dwarf::DW_APPLE_PROPERTY_retain) property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_retain); - if (property_attributes & DW_APPLE_PROPERTY_copy) + if (property_attributes & llvm::dwarf::DW_APPLE_PROPERTY_copy) property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_copy); - if (property_attributes & DW_APPLE_PROPERTY_nonatomic) + if (property_attributes & llvm::dwarf::DW_APPLE_PROPERTY_nonatomic) property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_nonatomic); if (property_attributes & ObjCPropertyAttribute::kind_nullability) property_decl->setPropertyAttributes( Index: lldb/source/Symbol/DWARFCallFrameInfo.cpp =================================================================== --- lldb/source/Symbol/DWARFCallFrameInfo.cpp +++ lldb/source/Symbol/DWARFCallFrameInfo.cpp @@ -34,7 +34,7 @@ uint32_t eh_ptr_enc, addr_t pc_rel_addr, addr_t text_addr, addr_t data_addr) //, BSDRelocs *data_relocs) const { - if (eh_ptr_enc == DW_EH_PE_omit) + if (eh_ptr_enc == llvm::dwarf::DW_EH_PE_omit) return ULLONG_MAX; // Value isn't in the buffer... uint64_t baseAddress = 0; @@ -45,7 +45,7 @@ bool signExtendValue = false; // Decode the base part or adjust our offset switch (eh_ptr_enc & 0x70) { - case DW_EH_PE_pcrel: + case llvm::dwarf::DW_EH_PE_pcrel: signExtendValue = true; baseAddress = *offset_ptr; if (pc_rel_addr != LLDB_INVALID_ADDRESS) @@ -55,7 +55,7 @@ // invalid pc relative address."); break; - case DW_EH_PE_textrel: + case llvm::dwarf::DW_EH_PE_textrel: signExtendValue = true; if (text_addr != LLDB_INVALID_ADDRESS) baseAddress = text_addr; @@ -65,7 +65,7 @@ // to zero."); break; - case DW_EH_PE_datarel: + case llvm::dwarf::DW_EH_PE_datarel: signExtendValue = true; if (data_addr != LLDB_INVALID_ADDRESS) baseAddress = data_addr; @@ -75,11 +75,11 @@ // to zero."); break; - case DW_EH_PE_funcrel: + case llvm::dwarf::DW_EH_PE_funcrel: signExtendValue = true; break; - case DW_EH_PE_aligned: { + case llvm::dwarf::DW_EH_PE_aligned: { // SetPointerSize should be called prior to extracting these so the pointer // size is cached assert(addr_size != 0); @@ -97,34 +97,34 @@ // Decode the value part switch (eh_ptr_enc & DW_EH_PE_MASK_ENCODING) { - case DW_EH_PE_absptr: { + case llvm::dwarf::DW_EH_PE_absptr: { addressValue = DE.GetAddress(offset_ptr); // if (data_relocs) // addressValue = data_relocs->Relocate(*offset_ptr - // addr_size, *this, addressValue); } break; - case DW_EH_PE_uleb128: + case llvm::dwarf::DW_EH_PE_uleb128: addressValue = DE.GetULEB128(offset_ptr); break; - case DW_EH_PE_udata2: + case llvm::dwarf::DW_EH_PE_udata2: addressValue = DE.GetU16(offset_ptr); break; - case DW_EH_PE_udata4: + case llvm::dwarf::DW_EH_PE_udata4: addressValue = DE.GetU32(offset_ptr); break; - case DW_EH_PE_udata8: + case llvm::dwarf::DW_EH_PE_udata8: addressValue = DE.GetU64(offset_ptr); break; - case DW_EH_PE_sleb128: + case llvm::dwarf::DW_EH_PE_sleb128: addressValue = DE.GetSLEB128(offset_ptr); break; - case DW_EH_PE_sdata2: + case llvm::dwarf::DW_EH_PE_sdata2: addressValue = (int16_t)DE.GetU16(offset_ptr); break; - case DW_EH_PE_sdata4: + case llvm::dwarf::DW_EH_PE_sdata4: addressValue = (int32_t)DE.GetU32(offset_ptr); break; - case DW_EH_PE_sdata8: + case llvm::dwarf::DW_EH_PE_sdata8: addressValue = (int64_t)DE.GetU64(offset_ptr); break; default: @@ -264,7 +264,7 @@ // cie.offset = cie_offset; // cie.length = length; // cie.cieID = cieID; - cie_sp->ptr_encoding = DW_EH_PE_absptr; // default + cie_sp->ptr_encoding = llvm::dwarf::DW_EH_PE_absptr; // default cie_sp->version = m_cfi_data.GetU8(&offset); if (cie_sp->version > CFI_VERSION4) { Host::SystemLog(Host::eSystemLogError, @@ -588,7 +588,8 @@ if (cie->augmentation[0] == 'z') { uint32_t aug_data_len = (uint32_t)m_cfi_data.GetULEB128(&offset); - if (aug_data_len != 0 && cie->lsda_addr_encoding != DW_EH_PE_omit) { + if (aug_data_len != 0 && + cie->lsda_addr_encoding != llvm::dwarf::DW_EH_PE_omit) { offset_t saved_offset = offset; lsda_data_file_address = GetGNUEHPointer(m_cfi_data, &offset, cie->lsda_addr_encoding, @@ -644,7 +645,7 @@ offset, *row)) { if (primary_opcode) { switch (primary_opcode) { - case DW_CFA_advance_loc: // (Row Creation Instruction) + case llvm::dwarf::DW_CFA_advance_loc: // (Row Creation Instruction) { // 0x40 - high 2 bits are 0x1, lower 6 bits are delta // takes a single argument that represents a constant delta. The // required action is to create a new table row with a location value @@ -659,8 +660,9 @@ break; } - case DW_CFA_restore: { // 0xC0 - high 2 bits are 0x3, lower 6 bits are - // register + case llvm::dwarf::DW_CFA_restore: { // 0xC0 - high 2 bits are 0x3, lower + // 6 bits are + // register // takes a single argument that represents a register number. The // required action is to change the rule for the indicated register // to the rule assigned it by the initial_instructions in the CIE. @@ -679,7 +681,7 @@ } } else { switch (extended_opcode) { - case DW_CFA_set_loc: // 0x1 (Row Creation Instruction) + case llvm::dwarf::DW_CFA_set_loc: // 0x1 (Row Creation Instruction) { // DW_CFA_set_loc takes a single argument that represents an address. // The required action is to create a new table row using the @@ -695,7 +697,7 @@ break; } - case DW_CFA_advance_loc1: // 0x2 (Row Creation Instruction) + case llvm::dwarf::DW_CFA_advance_loc1: // 0x2 (Row Creation Instruction) { // takes a single uword argument that represents a constant delta. // This instruction is identical to DW_CFA_advance_loc except for the @@ -708,7 +710,7 @@ break; } - case DW_CFA_advance_loc2: // 0x3 (Row Creation Instruction) + case llvm::dwarf::DW_CFA_advance_loc2: // 0x3 (Row Creation Instruction) { // takes a single uword argument that represents a constant delta. // This instruction is identical to DW_CFA_advance_loc except for the @@ -721,7 +723,7 @@ break; } - case DW_CFA_advance_loc4: // 0x4 (Row Creation Instruction) + case llvm::dwarf::DW_CFA_advance_loc4: // 0x4 (Row Creation Instruction) { // takes a single uword argument that represents a constant delta. // This instruction is identical to DW_CFA_advance_loc except for the @@ -734,7 +736,7 @@ break; } - case DW_CFA_restore_extended: // 0x6 + case llvm::dwarf::DW_CFA_restore_extended: // 0x6 { // takes a single unsigned LEB128 argument that represents a register // number. This instruction is identical to DW_CFA_restore except for @@ -747,7 +749,7 @@ break; } - case DW_CFA_remember_state: // 0xA + case llvm::dwarf::DW_CFA_remember_state: // 0xA { // These instructions define a stack of information. Encountering the // DW_CFA_remember_state instruction means to save the rules for @@ -763,7 +765,7 @@ break; } - case DW_CFA_restore_state: // 0xB + case llvm::dwarf::DW_CFA_restore_state: // 0xB { // These instructions define a stack of information. Encountering the // DW_CFA_remember_state instruction means to save the rules for @@ -788,7 +790,7 @@ break; } - case DW_CFA_GNU_args_size: // 0x2e + case llvm::dwarf::DW_CFA_GNU_args_size: // 0x2e { // The DW_CFA_GNU_args_size instruction takes an unsigned LEB128 // operand representing an argument size. This instruction specifies @@ -800,8 +802,8 @@ break; } - case DW_CFA_val_offset: // 0x14 - case DW_CFA_val_offset_sf: // 0x15 + case llvm::dwarf::DW_CFA_val_offset: // 0x14 + case llvm::dwarf::DW_CFA_val_offset_sf: // 0x15 default: break; } @@ -822,8 +824,9 @@ if (primary_opcode) { switch (primary_opcode) { - case DW_CFA_offset: { // 0x80 - high 2 bits are 0x2, lower 6 bits are - // register + case llvm::dwarf::DW_CFA_offset: { // 0x80 - high 2 bits are 0x2, lower 6 + // bits are + // register // takes two arguments: an unsigned LEB128 constant representing a // factored offset and a register number. The required action is to // change the rule for the register indicated by the register number to @@ -838,14 +841,15 @@ } } else { switch (extended_opcode) { - case DW_CFA_nop: // 0x0 + case llvm::dwarf::DW_CFA_nop: // 0x0 return true; - case DW_CFA_offset_extended: // 0x5 + case llvm::dwarf::DW_CFA_offset_extended: // 0x5 { // takes two unsigned LEB128 arguments representing a register number and - // a factored offset. This instruction is identical to DW_CFA_offset - // except for the encoding and size of the register argument. + // a factored offset. This instruction is identical to + // llvm::dwarf::DW_CFA_offset except for the encoding and size of the + // register argument. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset) * data_align; UnwindPlan::Row::RegisterLocation reg_location; @@ -854,7 +858,7 @@ return true; } - case DW_CFA_undefined: // 0x7 + case llvm::dwarf::DW_CFA_undefined: // 0x7 { // takes a single unsigned LEB128 argument that represents a register // number. The required action is to set the rule for the specified @@ -866,7 +870,7 @@ return true; } - case DW_CFA_same_value: // 0x8 + case llvm::dwarf::DW_CFA_same_value: // 0x8 { // takes a single unsigned LEB128 argument that represents a register // number. The required action is to set the rule for the specified @@ -878,7 +882,7 @@ return true; } - case DW_CFA_register: // 0x9 + case llvm::dwarf::DW_CFA_register: // 0x9 { // takes two unsigned LEB128 arguments representing register numbers. The // required action is to set the rule for the first register to be the @@ -891,7 +895,7 @@ return true; } - case DW_CFA_def_cfa: // 0xC (CFA Definition Instruction) + case llvm::dwarf::DW_CFA_def_cfa: // 0xC (CFA Definition Instruction) { // Takes two unsigned LEB128 operands representing a register number and // a (non-factored) offset. The required action is to define the current @@ -902,7 +906,8 @@ return true; } - case DW_CFA_def_cfa_register: // 0xD (CFA Definition Instruction) + case llvm::dwarf::DW_CFA_def_cfa_register: // 0xD (CFA Definition + // Instruction) { // takes a single unsigned LEB128 argument representing a register // number. The required action is to define the current CFA rule to use @@ -913,7 +918,8 @@ return true; } - case DW_CFA_def_cfa_offset: // 0xE (CFA Definition Instruction) + case llvm::dwarf::DW_CFA_def_cfa_offset: // 0xE (CFA Definition + // Instruction) { // Takes a single unsigned LEB128 operand representing a (non-factored) // offset. The required action is to define the current CFA rule to use @@ -924,7 +930,8 @@ return true; } - case DW_CFA_def_cfa_expression: // 0xF (CFA Definition Instruction) + case llvm::dwarf::DW_CFA_def_cfa_expression: // 0xF (CFA Definition + // Instruction) { size_t block_len = (size_t)m_cfi_data.GetULEB128(&offset); const uint8_t *block_data = @@ -933,7 +940,7 @@ return true; } - case DW_CFA_expression: // 0x10 + case llvm::dwarf::DW_CFA_expression: // 0x10 { // Takes two operands: an unsigned LEB128 value representing a register // number, and a DW_FORM_block value representing a DWARF expression. The @@ -952,7 +959,7 @@ return true; } - case DW_CFA_offset_extended_sf: // 0x11 + case llvm::dwarf::DW_CFA_offset_extended_sf: // 0x11 { // takes two operands: an unsigned LEB128 value representing a register // number and a signed LEB128 factored offset. This instruction is @@ -966,7 +973,7 @@ return true; } - case DW_CFA_def_cfa_sf: // 0x12 (CFA Definition Instruction) + case llvm::dwarf::DW_CFA_def_cfa_sf: // 0x12 (CFA Definition Instruction) { // Takes two operands: an unsigned LEB128 value representing a register // number and a signed LEB128 factored offset. This instruction is @@ -978,7 +985,8 @@ return true; } - case DW_CFA_def_cfa_offset_sf: // 0x13 (CFA Definition Instruction) + case llvm::dwarf::DW_CFA_def_cfa_offset_sf: // 0x13 (CFA Definition + // Instruction) { // takes a signed LEB128 operand representing a factored offset. This // instruction is identical to DW_CFA_def_cfa_offset except that the @@ -989,7 +997,7 @@ return true; } - case DW_CFA_val_expression: // 0x16 + case llvm::dwarf::DW_CFA_val_expression: // 0x16 { // takes two operands: an unsigned LEB128 value representing a register // number, and a DW_FORM_block value representing a DWARF expression. The Index: lldb/source/Symbol/PostfixExpression.cpp =================================================================== --- lldb/source/Symbol/PostfixExpression.cpp +++ lldb/source/Symbol/PostfixExpression.cpp @@ -150,7 +150,7 @@ void Visit(InitialValueNode &val, Node *&) override; void Visit(IntegerNode &integer, Node *&) override { - m_out_stream.PutHex8(DW_OP_consts); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_consts); m_out_stream.PutSLEB128(integer.GetValue()); ++m_stack_depth; } @@ -182,22 +182,22 @@ switch (binary.GetOpType()) { case BinaryOpNode::Plus: - m_out_stream.PutHex8(DW_OP_plus); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_plus); // NOTE: can be optimized by using DW_OP_plus_uconst opcpode // if right child node is constant value break; case BinaryOpNode::Minus: - m_out_stream.PutHex8(DW_OP_minus); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_minus); break; case BinaryOpNode::Align: // emit align operator a @ b as // a & ~(b - 1) // NOTE: implicitly assuming that b is power of 2 - m_out_stream.PutHex8(DW_OP_lit1); - m_out_stream.PutHex8(DW_OP_minus); - m_out_stream.PutHex8(DW_OP_not); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_lit1); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_minus); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_not); - m_out_stream.PutHex8(DW_OP_and); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_and); break; } --m_stack_depth; // Two pops, one push. @@ -207,7 +207,7 @@ // We never go below the initial stack, so we can pick the initial value from // the bottom of the stack at any moment. assert(m_stack_depth >= 1); - m_out_stream.PutHex8(DW_OP_pick); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_pick); m_out_stream.PutHex8(m_stack_depth - 1); ++m_stack_depth; } @@ -217,10 +217,10 @@ assert(reg_num != LLDB_INVALID_REGNUM); if (reg_num > 31) { - m_out_stream.PutHex8(DW_OP_bregx); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_bregx); m_out_stream.PutULEB128(reg_num); } else - m_out_stream.PutHex8(DW_OP_breg0 + reg_num); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_breg0 + reg_num); m_out_stream.PutSLEB128(0); ++m_stack_depth; @@ -231,7 +231,7 @@ switch (unary.GetOpType()) { case UnaryOpNode::Deref: - m_out_stream.PutHex8(DW_OP_deref); + m_out_stream.PutHex8(llvm::dwarf::DW_OP_deref); break; } // Stack depth unchanged. Index: lldb/unittests/Expression/DWARFExpressionTest.cpp =================================================================== --- lldb/unittests/Expression/DWARFExpressionTest.cpp +++ lldb/unittests/Expression/DWARFExpressionTest.cpp @@ -91,43 +91,52 @@ }; TEST(DWARFExpression, DW_OP_pick) { - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit1, DW_OP_lit0, DW_OP_pick, 0}), - llvm::HasValue(0)); - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit1, DW_OP_lit0, DW_OP_pick, 1}), - llvm::HasValue(1)); - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit1, DW_OP_lit0, DW_OP_pick, 2}), - llvm::Failed()); + EXPECT_THAT_EXPECTED( + Evaluate({llvm::dwarf::DW_OP_lit1, llvm::dwarf::DW_OP_lit0, + llvm::dwarf::DW_OP_pick, 0}), + llvm::HasValue(0)); + EXPECT_THAT_EXPECTED( + Evaluate({llvm::dwarf::DW_OP_lit1, llvm::dwarf::DW_OP_lit0, + llvm::dwarf::DW_OP_pick, 1}), + llvm::HasValue(1)); + EXPECT_THAT_EXPECTED( + Evaluate({llvm::dwarf::DW_OP_lit1, llvm::dwarf::DW_OP_lit0, + llvm::dwarf::DW_OP_pick, 2}), + llvm::Failed()); } TEST(DWARFExpression, DW_OP_const) { // Extend to address size. - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const1u, 0x88}), llvm::HasValue(0x88)); - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const1s, 0x88}), + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_const1u, 0x88}), + llvm::HasValue(0x88)); + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_const1s, 0x88}), llvm::HasValue(0xffffff88)); - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x47, 0x88}), + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_const2u, 0x47, 0x88}), llvm::HasValue(0x8847)); - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2s, 0x47, 0x88}), + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_const2s, 0x47, 0x88}), llvm::HasValue(0xffff8847)); - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const4u, 0x44, 0x42, 0x47, 0x88}), - llvm::HasValue(0x88474244)); - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const4s, 0x44, 0x42, 0x47, 0x88}), - llvm::HasValue(0x88474244)); - - // Truncate to address size. EXPECT_THAT_EXPECTED( - Evaluate({DW_OP_const8u, 0x00, 0x11, 0x22, 0x33, 0x44, 0x42, 0x47, 0x88}), - llvm::HasValue(0x33221100)); + Evaluate({llvm::dwarf::DW_OP_const4u, 0x44, 0x42, 0x47, 0x88}), + llvm::HasValue(0x88474244)); EXPECT_THAT_EXPECTED( - Evaluate({DW_OP_const8s, 0x00, 0x11, 0x22, 0x33, 0x44, 0x42, 0x47, 0x88}), - llvm::HasValue(0x33221100)); + Evaluate({llvm::dwarf::DW_OP_const4s, 0x44, 0x42, 0x47, 0x88}), + llvm::HasValue(0x88474244)); + + // Truncate to address size. + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_const8u, 0x00, 0x11, 0x22, + 0x33, 0x44, 0x42, 0x47, 0x88}), + llvm::HasValue(0x33221100)); + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_const8s, 0x00, 0x11, 0x22, + 0x33, 0x44, 0x42, 0x47, 0x88}), + llvm::HasValue(0x33221100)); // Don't truncate to address size for compatibility with clang (pr48087). - EXPECT_THAT_EXPECTED( - Evaluate({DW_OP_constu, 0x81, 0x82, 0x84, 0x88, 0x90, 0xa0, 0x40}), - llvm::HasValue(0x01010101010101)); - EXPECT_THAT_EXPECTED( - Evaluate({DW_OP_consts, 0x81, 0x82, 0x84, 0x88, 0x90, 0xa0, 0x40}), - llvm::HasValue(0xffff010101010101)); + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_constu, 0x81, 0x82, 0x84, + 0x88, 0x90, 0xa0, 0x40}), + llvm::HasValue(0x01010101010101)); + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_consts, 0x81, 0x82, 0x84, + 0x88, 0x90, 0xa0, 0x40}), + llvm::HasValue(0xffff010101010101)); } TEST(DWARFExpression, DW_OP_convert) { @@ -214,43 +223,51 @@ // Leave as is. EXPECT_THAT_EXPECTED( - t.Eval({DW_OP_const4u, 0x11, 0x22, 0x33, 0x44, // - DW_OP_convert, offs_uint32_t, DW_OP_stack_value}), + t.Eval({llvm::dwarf::DW_OP_const4u, 0x11, 0x22, 0x33, 0x44, // + llvm::dwarf::DW_OP_convert, offs_uint32_t, + llvm::dwarf::DW_OP_stack_value}), llvm::HasValue(GetScalar(64, 0x44332211, not_signed))); // Zero-extend to 64 bits. EXPECT_THAT_EXPECTED( - t.Eval({DW_OP_const4u, 0x11, 0x22, 0x33, 0x44, // - DW_OP_convert, offs_uint64_t, DW_OP_stack_value}), + t.Eval({llvm::dwarf::DW_OP_const4u, 0x11, 0x22, 0x33, 0x44, // + llvm::dwarf::DW_OP_convert, offs_uint64_t, + llvm::dwarf::DW_OP_stack_value}), llvm::HasValue(GetScalar(64, 0x44332211, not_signed))); // Sign-extend to 64 bits. EXPECT_THAT_EXPECTED( - t.Eval({DW_OP_const4s, 0xcc, 0xdd, 0xee, 0xff, // - DW_OP_convert, offs_sint64_t, DW_OP_stack_value}), + t.Eval({llvm::dwarf::DW_OP_const4s, 0xcc, 0xdd, 0xee, 0xff, // + llvm::dwarf::DW_OP_convert, offs_sint64_t, + llvm::dwarf::DW_OP_stack_value}), llvm::HasValue(GetScalar(64, 0xffffffffffeeddcc, is_signed))); // Sign-extend, then truncate. EXPECT_THAT_EXPECTED( - t.Eval({DW_OP_const4s, 0xcc, 0xdd, 0xee, 0xff, // - DW_OP_convert, offs_sint64_t, // - DW_OP_convert, offs_uint32_t, DW_OP_stack_value}), + t.Eval({llvm::dwarf::DW_OP_const4s, 0xcc, 0xdd, 0xee, 0xff, // + llvm::dwarf::DW_OP_convert, offs_sint64_t, // + llvm::dwarf::DW_OP_convert, offs_uint32_t, + llvm::dwarf::DW_OP_stack_value}), llvm::HasValue(GetScalar(32, 0xffeeddcc, not_signed))); // Truncate to default unspecified (pointer-sized) type. - EXPECT_THAT_EXPECTED(t.Eval({DW_OP_const4s, 0xcc, 0xdd, 0xee, 0xff, // - DW_OP_convert, offs_sint64_t, // - DW_OP_convert, 0x00, DW_OP_stack_value}), - llvm::HasValue(GetScalar(32, 0xffeeddcc, not_signed))); + EXPECT_THAT_EXPECTED( + t.Eval({llvm::dwarf::DW_OP_const4s, 0xcc, 0xdd, 0xee, 0xff, // + llvm::dwarf::DW_OP_convert, offs_sint64_t, // + llvm::dwarf::DW_OP_convert, 0x00, + llvm::dwarf::DW_OP_stack_value}), + llvm::HasValue(GetScalar(32, 0xffeeddcc, not_signed))); // Truncate to 8 bits. - EXPECT_THAT_EXPECTED(t.Eval({DW_OP_const4s, 'A', 'B', 'C', 'D', DW_OP_convert, - offs_uchar, DW_OP_stack_value}), + EXPECT_THAT_EXPECTED(t.Eval({llvm::dwarf::DW_OP_const4s, 'A', 'B', 'C', 'D', + llvm::dwarf::DW_OP_convert, offs_uchar, + llvm::dwarf::DW_OP_stack_value}), llvm::HasValue(GetScalar(8, 'A', not_signed))); // Also truncate to 8 bits. - EXPECT_THAT_EXPECTED(t.Eval({DW_OP_const4s, 'A', 'B', 'C', 'D', DW_OP_convert, - offs_schar, DW_OP_stack_value}), + EXPECT_THAT_EXPECTED(t.Eval({llvm::dwarf::DW_OP_const4s, 'A', 'B', 'C', 'D', + llvm::dwarf::DW_OP_convert, offs_schar, + llvm::dwarf::DW_OP_stack_value}), llvm::HasValue(GetScalar(8, 'A', is_signed))); // @@ -258,32 +275,39 @@ // // No Module. - EXPECT_THAT_ERROR(Evaluate({DW_OP_const1s, 'X', DW_OP_convert, 0x00}, nullptr, - t.GetDwarfUnit()) + EXPECT_THAT_ERROR(Evaluate({llvm::dwarf::DW_OP_const1s, 'X', + llvm::dwarf::DW_OP_convert, 0x00}, + nullptr, t.GetDwarfUnit()) .takeError(), llvm::Failed()); // No DIE. - EXPECT_THAT_ERROR( - t.Eval({DW_OP_const1s, 'X', DW_OP_convert, 0x01}).takeError(), - llvm::Failed()); + EXPECT_THAT_ERROR(t.Eval({llvm::dwarf::DW_OP_const1s, 'X', + llvm::dwarf::DW_OP_convert, 0x01}) + .takeError(), + llvm::Failed()); // Unsupported. - EXPECT_THAT_ERROR( - t.Eval({DW_OP_const1s, 'X', DW_OP_convert, 0x1d}).takeError(), - llvm::Failed()); + EXPECT_THAT_ERROR(t.Eval({llvm::dwarf::DW_OP_const1s, 'X', + llvm::dwarf::DW_OP_convert, 0x1d}) + .takeError(), + llvm::Failed()); } TEST(DWARFExpression, DW_OP_stack_value) { - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_stack_value}), llvm::Failed()); + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_stack_value}), + llvm::Failed()); } TEST(DWARFExpression, DW_OP_piece) { - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2, - DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}), - llvm::HasValue(GetScalar(32, 0x44332211, true))); EXPECT_THAT_EXPECTED( - Evaluate({DW_OP_piece, 1, DW_OP_const1u, 0xff, DW_OP_piece, 1}), + Evaluate({llvm::dwarf::DW_OP_const2u, 0x11, 0x22, + llvm::dwarf::DW_OP_piece, 2, llvm::dwarf::DW_OP_const2u, 0x33, + 0x44, llvm::dwarf::DW_OP_piece, 2}), + llvm::HasValue(GetScalar(32, 0x44332211, true))); + EXPECT_THAT_EXPECTED( + Evaluate({llvm::dwarf::DW_OP_piece, 1, llvm::dwarf::DW_OP_const1u, 0xff, + llvm::dwarf::DW_OP_piece, 1}), // Note that the "00" should really be "undef", but we can't // represent that yet. llvm::HasValue(GetScalar(16, 0xff00, true))); @@ -292,9 +316,9 @@ TEST(DWARFExpression, DW_OP_implicit_value) { unsigned char bytes = 4; - EXPECT_THAT_EXPECTED( - Evaluate({DW_OP_implicit_value, bytes, 0x11, 0x22, 0x33, 0x44}), - llvm::HasValue(GetScalar(8 * bytes, 0x44332211, true))); + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_implicit_value, bytes, 0x11, + 0x22, 0x33, 0x44}), + llvm::HasValue(GetScalar(8 * bytes, 0x44332211, true))); } TEST(DWARFExpression, DW_OP_unknown) { @@ -305,7 +329,9 @@ } TEST_F(DWARFExpressionMockProcessTest, DW_OP_deref) { - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit0, DW_OP_deref}), llvm::Failed()); + EXPECT_THAT_EXPECTED( + Evaluate({llvm::dwarf::DW_OP_lit0, llvm::dwarf::DW_OP_deref}), + llvm::Failed()); struct MockProcess : Process { using Process::Process; @@ -349,20 +375,26 @@ ExecutionContext exe_ctx(process_sp); // Implicit location: *0x4. - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit4, DW_OP_deref, DW_OP_stack_value}, - {}, {}, &exe_ctx), - llvm::HasValue(GetScalar(32, 0x07060504, false))); + EXPECT_THAT_EXPECTED( + Evaluate({llvm::dwarf::DW_OP_lit4, llvm::dwarf::DW_OP_deref, + llvm::dwarf::DW_OP_stack_value}, + {}, {}, &exe_ctx), + llvm::HasValue(GetScalar(32, 0x07060504, false))); // Memory location: *(*0x4). // Evaluate returns LLDB_INVALID_ADDRESS for all load addresses. - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit4, DW_OP_deref}, {}, {}, &exe_ctx), - llvm::HasValue(Scalar(LLDB_INVALID_ADDRESS))); + EXPECT_THAT_EXPECTED( + Evaluate({llvm::dwarf::DW_OP_lit4, llvm::dwarf::DW_OP_deref}, {}, {}, + &exe_ctx), + llvm::HasValue(Scalar(LLDB_INVALID_ADDRESS))); // Memory location: *0x4. // Evaluate returns LLDB_INVALID_ADDRESS for all load addresses. - EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit4}, {}, {}, &exe_ctx), + EXPECT_THAT_EXPECTED(Evaluate({llvm::dwarf::DW_OP_lit4}, {}, {}, &exe_ctx), llvm::HasValue(Scalar(4))); // Implicit location: *0x4. // Evaluate returns LLDB_INVALID_ADDRESS for all load addresses. EXPECT_THAT_EXPECTED( - Evaluate({DW_OP_lit4, DW_OP_deref, DW_OP_stack_value}, {}, {}, &exe_ctx), + Evaluate({llvm::dwarf::DW_OP_lit4, llvm::dwarf::DW_OP_deref, + llvm::dwarf::DW_OP_stack_value}, + {}, {}, &exe_ctx), llvm::HasValue(GetScalar(32, 0x07060504, false))); } Index: lldb/unittests/Process/minidump/MinidumpParserTest.cpp =================================================================== --- lldb/unittests/Process/minidump/MinidumpParserTest.cpp +++ lldb/unittests/Process/minidump/MinidumpParserTest.cpp @@ -105,12 +105,12 @@ ... )"), llvm::Succeeded()); - llvm::ArrayRef thread_list; + llvm::ArrayRef thread_list; thread_list = parser->GetThreads(); ASSERT_EQ(1UL, thread_list.size()); - const minidump::Thread &thread = thread_list[0]; + const llvm::minidump::Thread &thread = thread_list[0]; EXPECT_EQ(0x3e81u, thread.ThreadId); @@ -239,12 +239,12 @@ ... )"), llvm::Succeeded()); - llvm::ArrayRef modules = parser->GetModuleList(); - std::vector filtered_modules = + llvm::ArrayRef modules = parser->GetModuleList(); + std::vector filtered_modules = parser->GetFilteredModuleList(); EXPECT_EQ(2u, modules.size()); ASSERT_EQ(1u, filtered_modules.size()); - const minidump::Module &M = *filtered_modules[0]; + const llvm::minidump::Module &M = *filtered_modules[0]; EXPECT_THAT_EXPECTED(parser->GetMinidumpFile().getString(M.ModuleNameRVA), llvm::HasValue("/tmp/test/linux-x86_64_not_crashed")); } @@ -581,8 +581,8 @@ )"), llvm::Succeeded()); - llvm::ArrayRef thread_list = parser->GetThreads(); - const minidump::Thread &thread = thread_list[0]; + llvm::ArrayRef thread_list = parser->GetThreads(); + const llvm::minidump::Thread &thread = thread_list[0]; llvm::ArrayRef registers(parser->GetThreadContext(thread)); const MinidumpContext_x86_32 *context; EXPECT_TRUE(consumeObject(registers, context).Success()); @@ -624,8 +624,8 @@ ... )"), llvm::Succeeded()); - llvm::ArrayRef thread_list = parser->GetThreads(); - const minidump::Thread &thread = thread_list[0]; + llvm::ArrayRef thread_list = parser->GetThreads(); + const llvm::minidump::Thread &thread = thread_list[0]; llvm::ArrayRef registers(parser->GetThreadContext(thread)); const MinidumpContext_x86_64 *context; EXPECT_TRUE(consumeObject(registers, context).Success()); @@ -659,8 +659,8 @@ TEST_F(MinidumpParserTest, GetThreadContext_x86_32_wow64) { SetUpData("fizzbuzz_wow64.dmp"); - llvm::ArrayRef thread_list = parser->GetThreads(); - const minidump::Thread &thread = thread_list[0]; + llvm::ArrayRef thread_list = parser->GetThreads(); + const llvm::minidump::Thread &thread = thread_list[0]; llvm::ArrayRef registers(parser->GetThreadContextWow64(thread)); const MinidumpContext_x86_32 *context; EXPECT_TRUE(consumeObject(registers, context).Success()); @@ -708,7 +708,7 @@ llvm::Succeeded()); // If we have a module mentioned twice in the module list, the filtered // module list should contain the instance with the lowest BaseOfImage. - std::vector filtered_modules = + std::vector filtered_modules = parser->GetFilteredModuleList(); ASSERT_EQ(1u, filtered_modules.size()); EXPECT_EQ(0x0000000000001000u, filtered_modules[0]->BaseOfImage); @@ -748,7 +748,7 @@ // // This test will make sure that if the executable is second in the module // list, that it will become the selected module in the filtered list. - std::vector filtered_modules = + std::vector filtered_modules = parser->GetFilteredModuleList(); ASSERT_EQ(1u, filtered_modules.size()); EXPECT_EQ(0x400d3000u, filtered_modules[0]->BaseOfImage); @@ -789,7 +789,7 @@ // This test will make sure that if the executable is first in the module // list, that it will remain the correctly selected module in the filtered // list. - std::vector filtered_modules = + std::vector filtered_modules = parser->GetFilteredModuleList(); ASSERT_EQ(1u, filtered_modules.size()); EXPECT_EQ(0x400d0000u, filtered_modules[0]->BaseOfImage); @@ -830,7 +830,7 @@ // This test will make sure that if the executable is first in the module // list, that it will remain the correctly selected module in the filtered // list, even if the non-executable module was loaded at a lower base address. - std::vector filtered_modules = + std::vector filtered_modules = parser->GetFilteredModuleList(); ASSERT_EQ(1u, filtered_modules.size()); EXPECT_EQ(0x400d3000u, filtered_modules[0]->BaseOfImage); @@ -873,7 +873,7 @@ // where the first region for a binary won't be marked as executable, that // it gets selected by detecting the second consecutive mapping at 0x400d7000 // when asked about the a module mamed "/usr/lib/libc.so" at 0x400d5000. - std::vector filtered_modules = + std::vector filtered_modules = parser->GetFilteredModuleList(); ASSERT_EQ(1u, filtered_modules.size()); EXPECT_EQ(0x400d5000u, filtered_modules[0]->BaseOfImage); @@ -899,7 +899,7 @@ // Test module filtering does not affect the overall module order. Previous // versions of the MinidumpParser::GetFilteredModuleList() function would sort // all images by address and modify the order of the modules. - std::vector filtered_modules = + std::vector filtered_modules = parser->GetFilteredModuleList(); ASSERT_EQ(2u, filtered_modules.size()); EXPECT_EQ(0x0000000000002000u, filtered_modules[0]->BaseOfImage); Index: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp =================================================================== --- lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp +++ lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp @@ -240,7 +240,7 @@ DWARFUnit *unit = t.GetDwarfUnit(); ASSERT_NE(unit, nullptr); const DWARFDebugInfoEntry *cu_entry = unit->DIE().GetDIE(); - ASSERT_EQ(cu_entry->Tag(), DW_TAG_compile_unit); + ASSERT_EQ(cu_entry->Tag(), llvm::dwarf::DW_TAG_compile_unit); DWARFDIE cu_die(unit, cu_entry); TypeSystemClang ast_ctx("dummy ASTContext", HostInfoBase::GetTargetTriple()); @@ -250,7 +250,7 @@ // The DWARF above is just a list of functions. Parse all of them to // extract the function types and their calling convention values. for (DWARFDIE func : cu_die.children()) { - ASSERT_EQ(func.Tag(), DW_TAG_subprogram); + ASSERT_EQ(func.Tag(), llvm::dwarf::DW_TAG_subprogram); SymbolContext sc; bool new_type = false; lldb::TypeSP type = ast_parser.ParseTypeFromDWARF(sc, func, &new_type); Index: lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp =================================================================== --- lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp +++ lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp @@ -76,18 +76,18 @@ const uint8_t addr_size = 4; StreamString encoder(Stream::eBinary, addr_size, byte_order); encoder.PutULEB128(1); // Abbrev code 1 - encoder.PutULEB128(DW_TAG_compile_unit); - encoder.PutHex8(DW_CHILDREN_yes); - encoder.PutULEB128(DW_AT_name); - encoder.PutULEB128(DW_FORM_strp); + encoder.PutULEB128(llvm::dwarf::DW_TAG_compile_unit); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_yes); + encoder.PutULEB128(llvm::dwarf::DW_AT_name); + encoder.PutULEB128(llvm::dwarf::DW_FORM_strp); encoder.PutULEB128(0); encoder.PutULEB128(0); encoder.PutULEB128(2); // Abbrev code 2 - encoder.PutULEB128(DW_TAG_subprogram); - encoder.PutHex8(DW_CHILDREN_no); - encoder.PutULEB128(DW_AT_name); - encoder.PutULEB128(DW_FORM_strp); + encoder.PutULEB128(llvm::dwarf::DW_TAG_subprogram); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_no); + encoder.PutULEB128(llvm::dwarf::DW_AT_name); + encoder.PutULEB128(llvm::dwarf::DW_FORM_strp); encoder.PutULEB128(0); encoder.PutULEB128(0); @@ -104,11 +104,11 @@ EXPECT_EQ(abbrev_set.GetIndexOffset(), 1u); auto abbrev1 = abbrev_set.GetAbbreviationDeclaration(1); - EXPECT_EQ(abbrev1->Tag(), DW_TAG_compile_unit); + EXPECT_EQ(abbrev1->Tag(), llvm::dwarf::DW_TAG_compile_unit); EXPECT_TRUE(abbrev1->HasChildren()); EXPECT_EQ(abbrev1->NumAttributes(), 1u); auto abbrev2 = abbrev_set.GetAbbreviationDeclaration(2); - EXPECT_EQ(abbrev2->Tag(), DW_TAG_subprogram); + EXPECT_EQ(abbrev2->Tag(), llvm::dwarf::DW_TAG_subprogram); EXPECT_FALSE(abbrev2->HasChildren()); EXPECT_EQ(abbrev2->NumAttributes(), 1u); } @@ -121,18 +121,18 @@ const uint8_t addr_size = 4; StreamString encoder(Stream::eBinary, addr_size, byte_order); encoder.PutULEB128(5); // Abbrev code 5 - encoder.PutULEB128(DW_TAG_compile_unit); - encoder.PutHex8(DW_CHILDREN_yes); - encoder.PutULEB128(DW_AT_name); - encoder.PutULEB128(DW_FORM_strp); + encoder.PutULEB128(llvm::dwarf::DW_TAG_compile_unit); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_yes); + encoder.PutULEB128(llvm::dwarf::DW_AT_name); + encoder.PutULEB128(llvm::dwarf::DW_FORM_strp); encoder.PutULEB128(0); encoder.PutULEB128(0); encoder.PutULEB128(6); // Abbrev code 6 - encoder.PutULEB128(DW_TAG_subprogram); - encoder.PutHex8(DW_CHILDREN_no); - encoder.PutULEB128(DW_AT_name); - encoder.PutULEB128(DW_FORM_strp); + encoder.PutULEB128(llvm::dwarf::DW_TAG_subprogram); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_no); + encoder.PutULEB128(llvm::dwarf::DW_AT_name); + encoder.PutULEB128(llvm::dwarf::DW_FORM_strp); encoder.PutULEB128(0); encoder.PutULEB128(0); @@ -149,11 +149,11 @@ EXPECT_EQ(abbrev_set.GetIndexOffset(), 5u); auto abbrev1 = abbrev_set.GetAbbreviationDeclaration(5); - EXPECT_EQ(abbrev1->Tag(), DW_TAG_compile_unit); + EXPECT_EQ(abbrev1->Tag(), llvm::dwarf::DW_TAG_compile_unit); EXPECT_TRUE(abbrev1->HasChildren()); EXPECT_EQ(abbrev1->NumAttributes(), 1u); auto abbrev2 = abbrev_set.GetAbbreviationDeclaration(6); - EXPECT_EQ(abbrev2->Tag(), DW_TAG_subprogram); + EXPECT_EQ(abbrev2->Tag(), llvm::dwarf::DW_TAG_subprogram); EXPECT_FALSE(abbrev2->HasChildren()); EXPECT_EQ(abbrev2->NumAttributes(), 1u); } @@ -166,18 +166,18 @@ const uint8_t addr_size = 4; StreamString encoder(Stream::eBinary, addr_size, byte_order); encoder.PutULEB128(2); // Abbrev code 2 - encoder.PutULEB128(DW_TAG_compile_unit); - encoder.PutHex8(DW_CHILDREN_yes); - encoder.PutULEB128(DW_AT_name); - encoder.PutULEB128(DW_FORM_strp); + encoder.PutULEB128(llvm::dwarf::DW_TAG_compile_unit); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_yes); + encoder.PutULEB128(llvm::dwarf::DW_AT_name); + encoder.PutULEB128(llvm::dwarf::DW_FORM_strp); encoder.PutULEB128(0); encoder.PutULEB128(0); encoder.PutULEB128(1); // Abbrev code 1 - encoder.PutULEB128(DW_TAG_subprogram); - encoder.PutHex8(DW_CHILDREN_no); - encoder.PutULEB128(DW_AT_name); - encoder.PutULEB128(DW_FORM_strp); + encoder.PutULEB128(llvm::dwarf::DW_TAG_subprogram); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_no); + encoder.PutULEB128(llvm::dwarf::DW_AT_name); + encoder.PutULEB128(llvm::dwarf::DW_FORM_strp); encoder.PutULEB128(0); encoder.PutULEB128(0); @@ -194,11 +194,11 @@ EXPECT_EQ(abbrev_set.GetIndexOffset(), UINT32_MAX); auto abbrev1 = abbrev_set.GetAbbreviationDeclaration(2); - EXPECT_EQ(abbrev1->Tag(), DW_TAG_compile_unit); + EXPECT_EQ(abbrev1->Tag(), llvm::dwarf::DW_TAG_compile_unit); EXPECT_TRUE(abbrev1->HasChildren()); EXPECT_EQ(abbrev1->NumAttributes(), 1u); auto abbrev2 = abbrev_set.GetAbbreviationDeclaration(1); - EXPECT_EQ(abbrev2->Tag(), DW_TAG_subprogram); + EXPECT_EQ(abbrev2->Tag(), llvm::dwarf::DW_TAG_subprogram); EXPECT_FALSE(abbrev2->HasChildren()); EXPECT_EQ(abbrev2->NumAttributes(), 1u); } @@ -212,7 +212,7 @@ StreamString encoder(Stream::eBinary, addr_size, byte_order); encoder.PutULEB128(1); // Abbrev code 1 encoder.PutULEB128(0); // Invalid NULL tag here! - encoder.PutHex8(DW_CHILDREN_no); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_no); encoder.PutULEB128(0); encoder.PutULEB128(0); @@ -238,10 +238,10 @@ const uint8_t addr_size = 4; StreamString encoder(Stream::eBinary, addr_size, byte_order); encoder.PutULEB128(1); // Abbrev code 1 - encoder.PutULEB128(DW_TAG_compile_unit); - encoder.PutHex8(DW_CHILDREN_no); + encoder.PutULEB128(llvm::dwarf::DW_TAG_compile_unit); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_no); encoder.PutULEB128(0); // Invalid NULL DW_AT - encoder.PutULEB128(DW_FORM_strp); // With a valid form + encoder.PutULEB128(llvm::dwarf::DW_FORM_strp); // With a valid form encoder.PutULEB128(0); encoder.PutULEB128(0); @@ -266,9 +266,9 @@ const uint8_t addr_size = 4; StreamString encoder(Stream::eBinary, addr_size, byte_order); encoder.PutULEB128(1); // Abbrev code 1 - encoder.PutULEB128(DW_TAG_compile_unit); - encoder.PutHex8(DW_CHILDREN_no); - encoder.PutULEB128(DW_AT_name); // Valid attribute + encoder.PutULEB128(llvm::dwarf::DW_TAG_compile_unit); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_no); + encoder.PutULEB128(llvm::dwarf::DW_AT_name); // Valid attribute encoder.PutULEB128(0); // NULL form encoder.PutULEB128(0); encoder.PutULEB128(0); @@ -295,10 +295,10 @@ const uint8_t addr_size = 4; StreamString encoder(Stream::eBinary, addr_size, byte_order); encoder.PutULEB128(1); // Abbrev code 1 - encoder.PutULEB128(DW_TAG_compile_unit); - encoder.PutHex8(DW_CHILDREN_no); - encoder.PutULEB128(DW_AT_name); - encoder.PutULEB128(DW_FORM_strp); + encoder.PutULEB128(llvm::dwarf::DW_TAG_compile_unit); + encoder.PutHex8(llvm::dwarf::DW_CHILDREN_no); + encoder.PutULEB128(llvm::dwarf::DW_AT_name); + encoder.PutULEB128(llvm::dwarf::DW_FORM_strp); // Don't add the NULL DW_AT and NULL DW_FORM terminator DWARFDataExtractor data;