Index: llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp =================================================================== --- llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp +++ llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp @@ -141,11 +141,12 @@ void DWARFDebugAddrTable::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { if (DumpOpts.Verbose) OS << format("0x%8.8" PRIx32 ": ", HeaderOffset); - OS << format("Addr Section: length = 0x%8.8" PRIx32 - ", version = 0x%4.4" PRIx16 ", " - "addr_size = 0x%2.2" PRIx8 ", seg_size = 0x%2.2" PRIx8 "\n", - HeaderData.Length, HeaderData.Version, HeaderData.AddrSize, - HeaderData.SegSize); + if (HeaderData.Length) + OS << format("Address table header: length = 0x%8.8" PRIx32 + ", version = 0x%4.4" PRIx16 ", " + "addr_size = 0x%2.2" PRIx8 ", seg_size = 0x%2.2" PRIx8 "\n", + HeaderData.Length, HeaderData.Version, HeaderData.AddrSize, + HeaderData.SegSize); if (Addrs.size() > 0) { const char *AddrFmt = (HeaderData.AddrSize == 4) ? "0x%8.8" PRIx64 "\n" Index: llvm/test/DebugInfo/X86/debug_addr.ll =================================================================== --- llvm/test/DebugInfo/X86/debug_addr.ll +++ llvm/test/DebugInfo/X86/debug_addr.ll @@ -22,7 +22,6 @@ ; DWARF4: DW_TAG_GNU_call_site ; DWARF4: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000002) address = 0x0000000000000018 ".text") ; DWARF4: .debug_addr contents: -; DWARF4-NEXT: 0x00000000: Addr Section: length = 0x00000000, version = 0x0004, addr_size = 0x04, seg_size = 0x00 ; DWARF4-NEXT: Addrs: [ ; DWARF4-NEXT: 0x00000000 ; DWARF4-NEXT: 0x00000010 @@ -39,7 +38,7 @@ ; DWARF5: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000000 ".text") ; DWARF5: DW_AT_call_return_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000000018 ".text") ; DWARF5: .debug_addr contents: -; DWARF5-NEXT: 0x00000000: Addr Section: length = 0x00000010, version = 0x0005, addr_size = 0x04, seg_size = 0x00 +; DWARF5-NEXT: 0x00000000: Address table header: length = 0x00000010, version = 0x0005, addr_size = 0x04, seg_size = 0x00 ; DWARF5-NEXT: Addrs: [ ; DWARF5-NEXT: 0x00000000 ; DWARF5-NEXT: 0x00000010 Index: llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s =================================================================== --- llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s +++ llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s @@ -2,7 +2,6 @@ # RUN: llvm-dwarfdump --debug-addr %t.o | FileCheck %s # CHECK: .debug_addr contents -# CHECK-NEXT: length = 0x00000000, version = 0x0004, addr_size = 0x04, seg_size = 0x00 # CHECK-NEXT: Addrs: [ # CHECK-NEXT: 0x00000000 # CHECK-NEXT: 0x00000001