Index: llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h =================================================================== --- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h +++ llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h @@ -25,6 +25,8 @@ /// The total length of the entries for that set, not including the length /// field itself. uint64_t Length; + /// The DWARF format of the set. + dwarf::DwarfFormat Format; /// The offset from the beginning of the .debug_info section of the /// compilation unit entry referenced by the table. uint64_t CuOffset; Index: llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h =================================================================== --- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h +++ llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h @@ -44,6 +44,9 @@ /// field itself. uint64_t Length; + /// The DWARF format of the set. + dwarf::DwarfFormat Format; + /// This number is specific to the name lookup table and is independent of /// the DWARF version number. uint16_t Version; Index: llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h =================================================================== --- llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h +++ llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h @@ -55,6 +55,8 @@ }; dwarf::Form Form; /// Form for this value. + dwarf::DwarfFormat Format = + dwarf::DWARF32; /// Remember the DWARF format at extract time. ValueType Value; /// Contains all data for the form. const DWARFUnit *U = nullptr; /// Remember the DWARFUnit at extract time. const DWARFContext *C = nullptr; /// Context for extract time. Index: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h =================================================================== --- llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h +++ llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h @@ -291,6 +291,7 @@ return Header.getDwarfOffsetByteSize(); } uint64_t getLength() const { return Header.getLength(); } + dwarf::DwarfFormat getFormat() const { return Header.getFormat(); } uint8_t getUnitType() const { return Header.getUnitType(); } bool isTypeUnit() const { return Header.isTypeUnit(); } uint64_t getNextUnitOffset() const { return Header.getNextUnitOffset(); } Index: llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp @@ -15,8 +15,9 @@ using namespace llvm; void DWARFCompileUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) { + int OffsetDumpWidth = getFormat() == dwarf::DWARF64 ? 16 : 8; OS << format("0x%08" PRIx64, getOffset()) << ": Compile Unit:" - << " length = " << format("0x%08" PRIx64, getLength()) + << " length = " << format("0x%0*" PRIx64, OffsetDumpWidth, getLength()) << " version = " << format("0x%04x", getVersion()); if (getVersion() >= 5) OS << " unit_type = " << dwarf::UnitTypeString(getUnitType()); Index: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -162,6 +162,7 @@ } dwarf::DwarfFormat Format = Contribution->getFormat(); + int OffsetDumpWidth = Format == DWARF64 ? 16 : 8; uint16_t Version = Contribution->getVersion(); uint64_t ContributionHeader = Contribution->Base; // In DWARF v5 there is a contribution header that immediately precedes @@ -198,7 +199,7 @@ OS << format("0x%8.8" PRIx64 ": ", Offset); uint64_t StringOffset = StrOffsetExt.getRelocatedValue(EntrySize, &Offset); - OS << format("%8.8" PRIx64 " ", StringOffset); + OS << format("%0*" PRIx64 " ", OffsetDumpWidth, StringOffset); const char *S = StrData.getCStr(&StringOffset); if (S) OS << format("\"%s\"", S); Index: llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp @@ -60,12 +60,12 @@ // the segment selectors are omitted from all tuples, including // the terminating tuple. - dwarf::DwarfFormat format; Error Err = Error::success(); - std::tie(HeaderData.Length, format) = data.getInitialLength(offset_ptr, &Err); + std::tie(HeaderData.Length, HeaderData.Format) = + data.getInitialLength(offset_ptr, &Err); HeaderData.Version = data.getU16(offset_ptr, &Err); - HeaderData.CuOffset = - data.getUnsigned(offset_ptr, dwarf::getDwarfOffsetByteSize(format), &Err); + HeaderData.CuOffset = data.getUnsigned( + offset_ptr, dwarf::getDwarfOffsetByteSize(HeaderData.Format), &Err); HeaderData.AddrSize = data.getU8(offset_ptr, &Err); HeaderData.SegSize = data.getU8(offset_ptr, &Err); if (Err) { @@ -77,7 +77,7 @@ // Perform basic validation of the header fields. uint64_t full_length = - dwarf::getUnitLengthFieldByteSize(format) + HeaderData.Length; + dwarf::getUnitLengthFieldByteSize(HeaderData.Format) + HeaderData.Length; if (!data.isValidOffsetForDataOfSize(Offset, full_length)) return createStringError(errc::invalid_argument, "the length of address range table at offset " @@ -157,10 +157,12 @@ } void DWARFDebugArangeSet::dump(raw_ostream &OS) const { + int OffsetDumpWidth = HeaderData.Format == dwarf::DWARF64 ? 16 : 8; OS << "Address Range Header: " - << format("length = 0x%8.8" PRIx64 ", ", HeaderData.Length) + << format("length = 0x%0*" PRIx64 ", ", OffsetDumpWidth, HeaderData.Length) << format("version = 0x%4.4x, ", HeaderData.Version) - << format("cu_offset = 0x%8.8" PRIx64 ", ", HeaderData.CuOffset) + << format("cu_offset = 0x%0*" PRIx64 ", ", OffsetDumpWidth, + HeaderData.CuOffset) << format("addr_size = 0x%2.2x, ", HeaderData.AddrSize) << format("seg_size = 0x%2.2x\n", HeaderData.SegSize); Index: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -106,15 +106,18 @@ DIDumpOptions DumpOptions) const { if (!totalLengthIsValid()) return; + int OffsetDumpWidth = isDWARF64() ? 16 : 8; OS << "Line table prologue:\n" - << format(" total_length: 0x%8.8" PRIx64 "\n", TotalLength) + << format(" total_length: 0x%0*" PRIx64 "\n", OffsetDumpWidth, + TotalLength) << format(" version: %u\n", getVersion()); if (!versionIsSupported(getVersion())) return; if (getVersion() >= 5) OS << format(" address_size: %u\n", getAddressSize()) << format(" seg_select_size: %u\n", SegSelectorSize); - OS << format(" prologue_length: 0x%8.8" PRIx64 "\n", PrologueLength) + OS << format(" prologue_length: 0x%0*" PRIx64 "\n", OffsetDumpWidth, + PrologueLength) << format(" min_inst_length: %u\n", MinInstLength) << format(getVersion() >= 4 ? "max_ops_per_inst: %u\n" : "", MaxOpsPerInst) << format(" default_is_stmt: %u\n", DefaultIsStmt) Index: llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp @@ -28,9 +28,9 @@ Sets.push_back({}); Set &SetData = Sets.back(); - dwarf::DwarfFormat Format; - std::tie(SetData.Length, Format) = PubNames.getInitialLength(&Offset); - const unsigned OffsetSize = dwarf::getDwarfOffsetByteSize(Format); + std::tie(SetData.Length, SetData.Format) = + PubNames.getInitialLength(&Offset); + const unsigned OffsetSize = dwarf::getDwarfOffsetByteSize(SetData.Format); SetData.Version = PubNames.getU16(&Offset); SetData.Offset = PubNames.getRelocatedValue(OffsetSize, &Offset); @@ -50,15 +50,18 @@ void DWARFDebugPubTable::dump(raw_ostream &OS) const { for (const Set &S : Sets) { - OS << "length = " << format("0x%08" PRIx64, S.Length); + int OffsetDumpWidth = S.Format == dwarf::DWARF64 ? 16 : 8; + OS << "length = " << format("0x%0*" PRIx64, OffsetDumpWidth, S.Length); OS << " version = " << format("0x%04x", S.Version); - OS << " unit_offset = " << format("0x%08" PRIx64, S.Offset); - OS << " unit_size = " << format("0x%08" PRIx64, S.Size) << '\n'; + OS << " unit_offset = " + << format("0x%0*" PRIx64, OffsetDumpWidth, S.Offset); + OS << " unit_size = " << format("0x%0*" PRIx64, OffsetDumpWidth, S.Size) + << '\n'; OS << (GnuStyle ? "Offset Linkage Kind Name\n" : "Offset Name\n"); for (const Entry &E : S.Entries) { - OS << format("0x%8.8" PRIx64 " ", E.SecOffset); + OS << format("0x%0*" PRIx64 " ", OffsetDumpWidth, E.SecOffset); if (GnuStyle) { StringRef EntryLinkage = GDBIndexEntryLinkageString(E.Descriptor.Linkage); Index: llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -241,6 +241,7 @@ Ctx = &CU->getContext(); C = Ctx; U = CU; + Format = FP.Format; bool Indirect = false; bool IsBlock = false; Value.data = nullptr; @@ -481,12 +482,14 @@ break; case DW_FORM_strp: if (DumpOpts.Verbose) - OS << format(" .debug_str[0x%8.8" PRIx64 "] = ", UValue); + OS << format(" .debug_str[0x%0*" PRIx64 "] = ", + Format == DWARF64 ? 16 : 8, UValue); dumpString(OS); break; case DW_FORM_line_strp: if (DumpOpts.Verbose) - OS << format(" .debug_line_str[0x%8.8" PRIx64 "] = ", UValue); + OS << format(" .debug_line_str[0x%0*" PRIx64 "] = ", + Format == DWARF64 ? 16 : 8, UValue); dumpString(OS); break; case DW_FORM_strx: @@ -551,7 +554,7 @@ break; case DW_FORM_sec_offset: - AddrOS << format("0x%08" PRIx64, UValue); + AddrOS << format("0x%0*" PRIx64, Format == DWARF64 ? 16 : 8, UValue); break; default: Index: llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp @@ -79,20 +79,21 @@ void DWARFListTableHeader::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { if (DumpOpts.Verbose) OS << format("0x%8.8" PRIx64 ": ", HeaderOffset); - OS << format( - "%s list header: length = 0x%8.8" PRIx64 ", version = 0x%4.4" PRIx16 ", " - "addr_size = 0x%2.2" PRIx8 ", seg_size = 0x%2.2" PRIx8 - ", offset_entry_count = " - "0x%8.8" PRIx32 "\n", - ListTypeString.data(), HeaderData.Length, HeaderData.Version, - HeaderData.AddrSize, HeaderData.SegSize, HeaderData.OffsetEntryCount); + int OffsetDumpWidth = Format == dwarf::DWARF64 ? 16 : 8; + OS << format("%s list header: length = 0x%0*" PRIx64 + ", version = 0x%4.4" PRIx16 ", addr_size = 0x%2.2" PRIx8 + ", seg_size = 0x%2.2" PRIx8 + ", offset_entry_count = 0x%8.8" PRIx32 "\n", + ListTypeString.data(), OffsetDumpWidth, HeaderData.Length, + HeaderData.Version, HeaderData.AddrSize, HeaderData.SegSize, + HeaderData.OffsetEntryCount); if (HeaderData.OffsetEntryCount > 0) { OS << "offsets: ["; for (const auto &Off : Offsets) { - OS << format("\n0x%8.8" PRIx64, Off); + OS << format("\n0x%0*" PRIx64, OffsetDumpWidth, Off); if (DumpOpts.Verbose) - OS << format(" => 0x%8.8" PRIx64, + OS << format(" => 0x%08" PRIx64, Off + HeaderOffset + getHeaderSize(Format)); } OS << "\n]\n"; Index: llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp @@ -20,16 +20,18 @@ void DWARFTypeUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) { DWARFDie TD = getDIEForOffset(getTypeOffset() + getOffset()); const char *Name = TD.getName(DINameKind::ShortName); + int OffsetDumpWidth = getFormat() == dwarf::DWARF64 ? 16 : 8; if (DumpOpts.SummarizeTypes) { OS << "name = '" << Name << "'" << " type_signature = " << format("0x%016" PRIx64, getTypeHash()) - << " length = " << format("0x%08" PRIx64, getLength()) << '\n'; + << " length = " << format("0x%0*" PRIx64, OffsetDumpWidth, getLength()) + << '\n'; return; } OS << format("0x%08" PRIx64, getOffset()) << ": Type Unit:" - << " length = " << format("0x%08" PRIx64, getLength()) + << " length = " << format("0x%0*" PRIx64, OffsetDumpWidth, getLength()) << " version = " << format("0x%04x", getVersion()); if (getVersion() >= 5) OS << " unit_type = " << dwarf::UnitTypeString(getUnitType()); Index: llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s =================================================================== --- llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s +++ llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s @@ -28,11 +28,11 @@ # CHECK: Address Range Header: length = 0x0000001c, .L2version: .short 2 # Version - .long 0x11223344 # Debug Info Offset + .long 0x112233 # Debug Info Offset .byte 4 # Address Size .byte 0 # Segment Selector Size # CHECK-SAME: version = 0x0002, -# CHECK-SAME: cu_offset = 0x11223344, +# CHECK-SAME: cu_offset = 0x00112233, # CHECK-SAME: addr_size = 0x04, # CHECK-SAME: seg_size = 0x00 .space 4 # Padding @@ -48,11 +48,11 @@ # CHECK: Address Range Header: length = 0x0000002c, .L3version: .short 2 # Version - .long 0x22334455 # Debug Info Offset + .long 0x112233 # Debug Info Offset .byte 8 # Address Size .byte 0 # Segment Selector Size # CHECK-SAME: version = 0x0002, -# CHECK-SAME: cu_offset = 0x22334455, +# CHECK-SAME: cu_offset = 0x00112233, # CHECK-SAME: addr_size = 0x08, # CHECK-SAME: seg_size = 0x00 .space 4 # Padding @@ -67,14 +67,14 @@ ## Case 4: Check that 64-bit DWARF format is supported. .long 0xffffffff # DWARF64 mark .quad .L4end - .L4version # Length -# CHECK: Address Range Header: length = 0x0000001c, +# CHECK: Address Range Header: length = 0x000000000000001c, .L4version: .short 2 # Version - .quad 0x1234567899aabbcc # Debug Info Offset + .quad 0x123456789abc # Debug Info Offset .byte 4 # Address Size .byte 0 # Segment Selector Size # CHECK-SAME: version = 0x0002, -# CHECK-SAME: cu_offset = 0x1234567899aabbcc, +# CHECK-SAME: cu_offset = 0x0000123456789abc, # CHECK-SAME: addr_size = 0x04, # CHECK-SAME: seg_size = 0x00 # No padding Index: llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-dwarf64.s =================================================================== --- /dev/null +++ llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-dwarf64.s @@ -0,0 +1,54 @@ +# RUN: llvm-mc %s -filetype obj -triple x86_64 -o - | \ +# RUN: llvm-dwarfdump -v -debug-loclists - | \ +# RUN: FileCheck %s + +# CHECK: .debug_loclists contents: +# CHECK-NEXT: locations list header: +# CHECK-SAME: length = 0x0000000000000028, +# CHECK-SAME: version = 0x0005, +# CHECK-SAME: addr_size = 0x08, +# CHECK-SAME: seg_size = 0x00, +# CHECK-SAME: offset_entry_count = 0x00000002 +# CHECK-NEXT: offsets: [ +# CHECK-NEXT: 0x0000000000000010 => 0x00000024 +# CHECK-NEXT: 0x0000000000000018 => 0x0000002c +# CHECK-NEXT: ] +# CHECK-NEXT: 0x00000024: +# CHECK-NEXT: DW_LLE_offset_pair (0x0000000000000001, 0x0000000000000002): DW_OP_consts +7, DW_OP_stack_value +# CHECK-NEXT: DW_LLE_end_of_list () +# CHECK-EMPTY: +# CHECK-NEXT: 0x0000002c: +# CHECK-NEXT: DW_LLE_offset_pair (0x0000000000000005, 0x0000000000000007): DW_OP_consts +12, DW_OP_stack_value +# CHECK-NEXT: DW_LLE_end_of_list () + + .section .debug_loclists, "", @progbits + .long 0xffffffff # DWARF64 mark + .quad .LLLEnd-.LLLBegin # Length +.LLLBegin: + .short 5 # Version + .byte 8 # Address size + .byte 0 # Segment selector size + .long 2 # Offset entry count +.LLLBase: + .quad .LLL0-.LLLBase + .quad .LLL1-.LLLBase +.LLL0: + .byte 4 # DW_LLE_offset_pair + .uleb128 1 # starting offset + .uleb128 2 # ending offset + .byte 3 # Loc expr size + .byte 17 # DW_OP_consts + .byte 7 # 7 + .byte 159 # DW_OP_stack_value + .byte 0 # DW_LLE_end_of_list + +.LLL1: + .byte 4 # DW_LLE_offset_pair + .uleb128 5 # starting offset + .uleb128 7 # ending offset + .byte 3 # Loc expr size + .byte 17 # DW_OP_consts + .byte 12 # 12 + .byte 159 # DW_OP_stack_value + .byte 0 # DW_LLE_end_of_list +.LLLEnd: Index: llvm/test/DebugInfo/X86/dwarfdump-debug-pubnames.s =================================================================== --- llvm/test/DebugInfo/X86/dwarfdump-debug-pubnames.s +++ llvm/test/DebugInfo/X86/dwarfdump-debug-pubnames.s @@ -3,24 +3,24 @@ # RUN: FileCheck %s # CHECK: .debug_pubnames contents: -# CHECK-NEXT: length = 0x00000032 +# CHECK-NEXT: length = 0x0000000000000032 # CHECK-SAME: version = 0x0002 -# CHECK-SAME: unit_offset = 0x1122334455667788 -# CHECK-SAME: unit_size = 0x1100220033004400 +# CHECK-SAME: unit_offset = 0x0000112233445566 +# CHECK-SAME: unit_size = 0x0000110022003300 # CHECK-NEXT: Offset Name -# CHECK-NEXT: 0xaa01aaaabbbbbbbb "foo" -# CHECK-NEXT: 0xaa02aaaabbbbbbbb "bar" +# CHECK-NEXT: 0x0000aa01aaaabbbb "foo" +# CHECK-NEXT: 0x0000aa02aaaabbbb "bar" .section .debug_pubnames,"",@progbits .long 0xffffffff # DWARF64 mark .quad .Lend - .Lversion # Unit Length .Lversion: .short 2 # Version - .quad 0x1122334455667788 # Debug Info Offset - .quad 0x1100220033004400 # Debug Info Length - .quad 0xaa01aaaabbbbbbbb # Tuple0: Offset + .quad 0x112233445566 # Debug Info Offset + .quad 0x110022003300 # Debug Info Length + .quad 0xaa01aaaabbbb # Tuple0: Offset .asciz "foo" # Name - .quad 0xaa02aaaabbbbbbbb # Tuple1: Offset + .quad 0xaa02aaaabbbb # Tuple1: Offset .asciz "bar" # Name .quad 0 # Terminator .Lend: Index: llvm/test/DebugInfo/X86/dwarfdump-header-64.s =================================================================== --- llvm/test/DebugInfo/X86/dwarfdump-header-64.s +++ llvm/test/DebugInfo/X86/dwarfdump-header-64.s @@ -153,14 +153,14 @@ # CHECK-LABEL: .debug_line contents: # CHECK: Line table prologue: -# CHECK: total_length: 0x00000050 +# CHECK: total_length: 0x0000000000000050 # CHECK: version: 5 # CHECK: address_size: 8 # CHECK: seg_select_size: 0 -# CHECK: prologue_length: 0x00000044 +# CHECK: prologue_length: 0x0000000000000044 # CHECK: max_ops_per_inst: 1 -# CHECK: include_directories[ 0] = .debug_str[0x00000028] = "Directory5a" -# CHECK: include_directories[ 1] = .debug_str[0x00000034] = "Directory5b" +# CHECK: include_directories[ 0] = .debug_str[0x0000000000000028] = "Directory5a" +# CHECK: include_directories[ 1] = .debug_str[0x0000000000000034] = "Directory5b" # CHECK-NOT: include_directories # CHECK: file_names[ 0]: # CHECK-NEXT: name: "File5a" Index: llvm/test/DebugInfo/X86/dwarfdump-rnglists-dwarf64.s =================================================================== --- llvm/test/DebugInfo/X86/dwarfdump-rnglists-dwarf64.s +++ llvm/test/DebugInfo/X86/dwarfdump-rnglists-dwarf64.s @@ -3,6 +3,8 @@ # RUN: FileCheck %s --input-file %t.err --check-prefix=ERR # RUN: not llvm-dwarfdump -lookup 10 %t.o 2> %t2.err # RUN: FileCheck %s --input-file %t2.err --check-prefix=ERR +# RUN: llvm-dwarfdump -debug-rnglists %t.o | \ +# RUN: FileCheck %s --check-prefix=RNGLISTS # Test object to verify dwarfdump handles v5 range lists in 64-bit DWARF format. # This is similar to 'dwarfdump-rnglists.s', which uses 32-bit DWARF format. @@ -188,15 +190,15 @@ # CHECK: Compile Unit: # CHECK-NOT: Compile Unit: # CHECK: DW_TAG_compile_unit -# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x00000014) -# CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000024 +# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000000000014) +# CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x0000000000000024 # CHECK-NEXT: [0x00000014, 0x0000001e) ".text" # CHECK-NEXT: [0x0000002a, 0x00000034) ".text") # CHECK: Compile Unit: # CHECK-NOT: Compile Unit: # CHECK: DW_TAG_compile_unit -# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x00000014) +# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000000000014) # CHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000034 # CHECK-NEXT: [0x0000002a, 0x00000034) ".text") @@ -210,3 +212,37 @@ #ERR: error: parsing a range list table: did not detect a valid list table with base = 0x8 #ERR: error: decoding address ranges: missing or invalid range list table #ERR: error: decoding address ranges: invalid range list offset 0xfa0 + +# RNGLISTS: .debug_rnglists contents: +# RNGLISTS: range list header: +# RNGLISTS-SAME: length = 0x0000000000000031, +# RNGLISTS-SAME: version = 0x0005, +# RNGLISTS-SAME: addr_size = 0x04, +# RNGLISTS-SAME: seg_size = 0x00, +# RNGLISTS-SAME: offset_entry_count = 0x00000002 +# RNGLISTS-NEXT: offsets: [ +# RNGLISTS-NEXT: 0x0000000000000010 +# RNGLISTS-NEXT: 0x0000000000000020 +# RNGLISTS-NEXT: ] +# RNGLISTS-NEXT: ranges: +# RNGLISTS-NEXT: [0x00000014, 0x0000001e) +# RNGLISTS-NEXT: [0x0000002a, 0x00000034) +# RNGLISTS-NEXT: +# RNGLISTS-NEXT: [0x0000002a, 0x00000034) +# RNGLISTS-NEXT: + +# RNGLISTS: .debug_rnglists.dwo contents: +# RNGLISTS: range list header: +# RNGLISTS-SAME: length = 0x0000000000000022, +# RNGLISTS-SAME: version = 0x0005, +# RNGLISTS-SAME: addr_size = 0x04, +# RNGLISTS-SAME: seg_size = 0x00, +# RNGLISTS-SAME: offset_entry_count = 0x00000002 +# RNGLISTS-NEXT: offsets: [ +# RNGLISTS-NEXT: 0x0000000000000010 +# RNGLISTS-NEXT: 0x0000000000000011 +# RNGLISTS-NEXT: ] +# RNGLISTS-NEXT: ranges: +# RNGLISTS-NEXT: +# RNGLISTS-NEXT: [0x0000002a, 0x00000034) +# RNGLISTS-NEXT: Index: llvm/test/DebugInfo/X86/dwarfdump-str-offsets-macho.s =================================================================== --- llvm/test/DebugInfo/X86/dwarfdump-str-offsets-macho.s +++ llvm/test/DebugInfo/X86/dwarfdump-str-offsets-macho.s @@ -238,7 +238,7 @@ # COMMON: DW_TAG_compile_unit # COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer") # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2") -# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000038) +# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000000000000038) # COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2") # # The type unit @@ -261,9 +261,9 @@ # COMMON-NEXT: 0x00000020: 0000007c "MyVar3" # COMMON-NEXT: 0x00000024: Gap, length = 4 # COMMON-NEXT: 0x00000028: Contribution size = 28, Format = DWARF64, Version = 5 -# COMMON-NEXT: 0x00000038: 00000000 "Handmade DWARF producer" -# COMMON-NEXT: 0x00000040: 00000036 "Compile_Unit_2" -# COMMON-NEXT: 0x00000048: 00000045 "/home/test/CU2" +# COMMON-NEXT: 0x00000038: 0000000000000000 "Handmade DWARF producer" +# COMMON-NEXT: 0x00000040: 0000000000000036 "Compile_Unit_2" +# COMMON-NEXT: 0x00000048: 0000000000000045 "/home/test/CU2" # COMMON-NEXT: 0x00000050: Contribution size = 12, Format = DWARF32, Version = 5 # COMMON-NEXT: 0x00000058: 00000054 "Type_Unit" # COMMON-NEXT: 0x0000005c: 0000005e "MyStruct" Index: llvm/test/DebugInfo/X86/dwarfdump-str-offsets-v4-dwarf64-dwo.s =================================================================== --- llvm/test/DebugInfo/X86/dwarfdump-str-offsets-v4-dwarf64-dwo.s +++ llvm/test/DebugInfo/X86/dwarfdump-str-offsets-v4-dwarf64-dwo.s @@ -25,9 +25,9 @@ # CHECK: .debug_str_offsets.dwo contents: # CHECK-NEXT: 0x00000000: Contribution size = 24, Format = DWARF64, Version = 4 -# CHECK-NEXT: 0x00000000: 00000000 "Compilation Unit" -# CHECK-NEXT: 0x00000008: 00000011 "Type Unit" -# CHECK-NEXT: 0x00000010: 0000001b "Structure" +# CHECK-NEXT: 0x00000000: 0000000000000000 "Compilation Unit" +# CHECK-NEXT: 0x00000008: 0000000000000011 "Type Unit" +# CHECK-NEXT: 0x00000010: 000000000000001b "Structure" .section .debug_str.dwo, "MSe", @progbits, 1 .LStr0: Index: llvm/test/DebugInfo/X86/dwarfdump-str-offsets-v4-dwarf64-dwp.s =================================================================== --- llvm/test/DebugInfo/X86/dwarfdump-str-offsets-v4-dwarf64-dwp.s +++ llvm/test/DebugInfo/X86/dwarfdump-str-offsets-v4-dwarf64-dwp.s @@ -30,8 +30,8 @@ # CHECK-NEXT: 0x00000000: 00000000 "CU0 Producer" # CHECK-NEXT: 0x00000004: 0000000d "CU0 Name" # CHECK-NEXT: 0x00000008: Contribution size = 16, Format = DWARF64, Version = 4 -# CHECK-NEXT: 0x00000008: 00000016 "CU1 Producer" -# CHECK-NEXT: 0x00000010: 00000023 "CU1 Name" +# CHECK-NEXT: 0x00000008: 0000000000000016 "CU1 Producer" +# CHECK-NEXT: 0x00000010: 0000000000000023 "CU1 Name" .section .debug_str.dwo, "MSe", @progbits, 1 .LStr0: Index: llvm/test/DebugInfo/X86/dwarfdump-str-offsets.s =================================================================== --- llvm/test/DebugInfo/X86/dwarfdump-str-offsets.s +++ llvm/test/DebugInfo/X86/dwarfdump-str-offsets.s @@ -377,7 +377,7 @@ # COMMON: DW_TAG_compile_unit # COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer") # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2") -# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000038) +# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000000000000038) # COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2") # # The split CU @@ -414,9 +414,9 @@ # COMMON-NEXT: 0x00000020: 0000007c "MyVar3" # COMMON-NEXT: Gap, length = 4 # COMMON-NEXT: 0x00000028: Contribution size = 28, Format = DWARF64, Version = 5 -# COMMON-NEXT: 0x00000038: 00000000 "Handmade DWARF producer" -# COMMON-NEXT: 0x00000040: 00000036 "Compile_Unit_2" -# COMMON-NEXT: 0x00000048: 00000045 "/home/test/CU2" +# COMMON-NEXT: 0x00000038: 0000000000000000 "Handmade DWARF producer" +# COMMON-NEXT: 0x00000040: 0000000000000036 "Compile_Unit_2" +# COMMON-NEXT: 0x00000048: 0000000000000045 "/home/test/CU2" # COMMON-NEXT: 0x00000050: Contribution size = 12, Format = DWARF32, Version = 5 # COMMON-NEXT: 0x00000058: 00000054 "Type_Unit" # COMMON-NEXT: 0x0000005c: 0000005e "MyStruct" Index: llvm/test/DebugInfo/X86/dwp-dwarf64.s =================================================================== --- llvm/test/DebugInfo/X86/dwp-dwarf64.s +++ llvm/test/DebugInfo/X86/dwp-dwarf64.s @@ -5,7 +5,7 @@ # CHECK: .debug_info.dwo contents: # CHECK: 0x00000000: Compile Unit: -# CHECK-SAME: length = 0x00000018 +# CHECK-SAME: length = 0x0000000000000018 # CHECK-SAME: version = 0x0004 # CHECK-SAME: abbr_offset = 0x0000 # CHECK-SAME: addr_size = 0x04 Index: llvm/test/DebugInfo/dwarfdump-64-bit-dwarf.test =================================================================== --- llvm/test/DebugInfo/dwarfdump-64-bit-dwarf.test +++ llvm/test/DebugInfo/dwarfdump-64-bit-dwarf.test @@ -4,9 +4,9 @@ # FIXME: llvm-dwarfdump's support for 64-bit dwarf is currently limited to # .debug_line. -CHECK: total_length: 0x00000212 +CHECK: total_length: 0x0000000000000212 CHECK: version: 2 -CHECK:prologue_length: 0x000001ab +CHECK:prologue_length: 0x00000000000001ab CHECK:min_inst_length: 1 CHECK:default_is_stmt: 1 CHECK: line_base: -5 @@ -14,9 +14,9 @@ CHECK: opcode_base: 13 CHECK: is_stmt end_sequence -CHECK: total_length: 0x0000007c +CHECK: total_length: 0x000000000000007c CHECK: version: 2 -CHECK:prologue_length: 0x00000048 +CHECK:prologue_length: 0x0000000000000048 CHECK:min_inst_length: 1 CHECK:default_is_stmt: 1 CHECK: line_base: -5 @@ -24,9 +24,9 @@ CHECK: opcode_base: 13 CHECK: is_stmt end_sequence -CHECK: total_length: 0x00000094 +CHECK: total_length: 0x0000000000000094 CHECK: version: 2 -CHECK:prologue_length: 0x00000044 +CHECK:prologue_length: 0x0000000000000044 CHECK:min_inst_length: 1 CHECK:default_is_stmt: 1 CHECK: line_base: -5 @@ -34,9 +34,9 @@ CHECK: opcode_base: 13 CHECK: is_stmt end_sequence -CHECK: total_length: 0x0000007c +CHECK: total_length: 0x000000000000007c CHECK: version: 2 -CHECK:prologue_length: 0x00000048 +CHECK:prologue_length: 0x0000000000000048 CHECK:min_inst_length: 1 CHECK:default_is_stmt: 1 CHECK: line_base: -5 Index: llvm/test/tools/llvm-dwarfdump/X86/debug_info_min_dwarf64.s =================================================================== --- llvm/test/tools/llvm-dwarfdump/X86/debug_info_min_dwarf64.s +++ llvm/test/tools/llvm-dwarfdump/X86/debug_info_min_dwarf64.s @@ -18,7 +18,7 @@ DI_4_64_start: .long 0xffffffff # DWARF64 mark .quad DI_4_64_end - DI_4_64_version # Length of Unit -# CHECK-SAME: length = 0x0000000f +# CHECK-SAME: length = 0x000000000000000f DI_4_64_version: .short 4 # DWARF version number # CHECK-SAME: version = 0x0004 Index: llvm/test/tools/llvm-dwarfdump/X86/debug_line_dwarf64_large_table.s =================================================================== --- llvm/test/tools/llvm-dwarfdump/X86/debug_line_dwarf64_large_table.s +++ llvm/test/tools/llvm-dwarfdump/X86/debug_line_dwarf64_large_table.s @@ -8,9 +8,9 @@ # CHECK: debug_line[0x00000000] # CHECK-NEXT: warning: line table program with offset 0x00000000 has length 0xfffffffc but only 0x0000003a bytes are available # CHECK-NEXT: Line table prologue: -# CHECK-NEXT: total_length: 0xfffffff0 +# CHECK-NEXT: total_length: 0x00000000fffffff0 # CHECK-NEXT: version: 4 -# CHECK-NEXT: prologue_length: 0x00000016 +# CHECK-NEXT: prologue_length: 0x0000000000000016 # CHECK: 0x000000000badbeef 1 0 1 0 0 is_stmt end_sequence Index: llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_dwarf64.s =================================================================== --- llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_dwarf64.s +++ llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_dwarf64.s @@ -4,14 +4,14 @@ # CHECK: .debug_rnglists contents: # CHECK-NEXT: 0x00000000: range list header: -# CHECK-SAME: length = 0x0000001a, +# CHECK-SAME: length = 0x000000000000001a, # CHECK-SAME: version = 0x0005, # CHECK-SAME: addr_size = 0x08, # CHECK-SAME: seg_size = 0x00, # CHECK-SAME: offset_entry_count = 0x00000002 # CHECK-NEXT: offsets: [ -# CHECK-NEXT: 0x00000010 => 0x00000024 -# CHECK-NEXT: 0x00000011 => 0x00000025 +# CHECK-NEXT: 0x0000000000000010 => 0x00000024 +# CHECK-NEXT: 0x0000000000000011 => 0x00000025 # CHECK-NEXT: ] # CHECK-NEXT: ranges: # CHECK-NEXT: 0x00000024: [DW_RLE_end_of_list] Index: llvm/test/tools/llvm-dwarfdump/X86/typeunit-v4-dwarf64.s =================================================================== --- llvm/test/tools/llvm-dwarfdump/X86/typeunit-v4-dwarf64.s +++ llvm/test/tools/llvm-dwarfdump/X86/typeunit-v4-dwarf64.s @@ -25,7 +25,7 @@ TU_4_64_start: .long 0xffffffff # DWARF64 mark .quad TU_4_64_end-TU_4_64_version # Length of Unit -# CHECK-SAME: length = 0x00000021 +# CHECK-SAME: length = 0x0000000000000021 TU_4_64_version: .short 4 # DWARF version number # CHECK-SAME: version = 0x0004 Index: llvm/test/tools/llvm-dwarfdump/X86/typeunit-v5-dwarf64.s =================================================================== --- llvm/test/tools/llvm-dwarfdump/X86/typeunit-v5-dwarf64.s +++ llvm/test/tools/llvm-dwarfdump/X86/typeunit-v5-dwarf64.s @@ -25,7 +25,7 @@ TU_5_64_start: .long 0xffffffff # DWARF64 mark .quad TU_5_64_end-TU_5_64_version # Length of Unit -# CHECK-SAME: length = 0x00000022 +# CHECK-SAME: length = 0x0000000000000022 TU_5_64_version: .short 5 # DWARF version number # CHECK-SAME: version = 0x0005 Index: llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp =================================================================== --- llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp +++ llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp @@ -384,15 +384,15 @@ testing::Values(DumpValueParams{DW_FORM_strp, DumpTestSample32, DWARF32, " .debug_str[0x00112233] = "}, DumpValueParams{DW_FORM_strp, DumpTestSample64, DWARF64, - " .debug_str[0x11223344556677] = "}, + " .debug_str[0x0011223344556677] = "}, DumpValueParams{DW_FORM_line_strp, DumpTestSample32, DWARF32, " .debug_line_str[0x00112233] = "}, DumpValueParams{DW_FORM_line_strp, DumpTestSample64, DWARF64, - " .debug_line_str[0x11223344556677] = "}, + " .debug_line_str[0x0011223344556677] = "}, DumpValueParams{DW_FORM_sec_offset, DumpTestSample32, DWARF32, "0x00112233"}, DumpValueParams{DW_FORM_sec_offset, DumpTestSample64, - DWARF64, "0x11223344556677"}), ); + DWARF64, "0x0011223344556677"}), ); } // end anonymous namespace