diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h @@ -143,7 +143,7 @@ void reset(bool DefaultIsStmt); void dump(raw_ostream &OS) const; - static void dumpTableHeader(raw_ostream &OS); + static void dumpTableHeader(raw_ostream &OS, unsigned Indent); static bool orderByAddress(const Row &LHS, const Row &RHS) { return std::tie(LHS.Address.SectionIndex, LHS.Address.Address) < diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -459,10 +459,12 @@ EpilogueBegin = false; } -void DWARFDebugLine::Row::dumpTableHeader(raw_ostream &OS) { - OS << "Address Line Column File ISA Discriminator Flags\n" - << "------------------ ------ ------ ------ --- ------------- " - "-------------\n"; +void DWARFDebugLine::Row::dumpTableHeader(raw_ostream &OS, unsigned Indent) { + OS.indent(Indent) + << "Address Line Column File ISA Discriminator Flags\n"; + OS.indent(Indent) + << "------------------ ------ ------ ------ --- ------------- " + "-------------\n"; } void DWARFDebugLine::Row::dump(raw_ostream &OS) const { @@ -493,7 +495,7 @@ if (!Rows.empty()) { OS << '\n'; - Row::dumpTableHeader(OS); + Row::dumpTableHeader(OS, 0); for (const Row &R : Rows) { R.dump(OS); } @@ -700,6 +702,8 @@ DIDumpOptions DumpOptions; DumpOptions.Verbose = true; Prologue.dump(*OS, DumpOptions); + *OS << '\n'; + Row::dumpTableHeader(*OS, 12); } if (PrologueErr) diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -763,7 +763,7 @@ << "] row[" << RowIndex << "] decreases in address from previous row:\n"; - DWARFDebugLine::Row::dumpTableHeader(OS); + DWARFDebugLine::Row::dumpTableHeader(OS, 0); if (RowIndex > 0) LineTable->Rows[RowIndex - 1].dump(OS); Row.dump(OS); @@ -781,7 +781,7 @@ << " (valid values are [" << (isDWARF5 ? "0," : "1,") << LineTable->Prologue.FileNames.size() << (isDWARF5 ? ")" : "]") << "):\n"; - DWARFDebugLine::Row::dumpTableHeader(OS); + DWARFDebugLine::Row::dumpTableHeader(OS, 0); Row.dump(OS); OS << '\n'; } diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-line-dw-lne-end-sequence.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-line-dw-lne-end-sequence.s --- a/llvm/test/tools/llvm-dwarfdump/X86/debug-line-dw-lne-end-sequence.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-line-dw-lne-end-sequence.s @@ -2,14 +2,23 @@ ## properly and the rows are printed correctly. # RUN: llvm-mc -filetype obj -triple x86_64 %s -o %t.o -# RUN: llvm-dwarfdump --debug-line %t.o | FileCheck %s --check-prefixes=HEADER,ROWS -# RUN: llvm-dwarfdump --debug-line %t.o --verbose | FileCheck %s --check-prefix=ROWS +# RUN: llvm-dwarfdump --debug-line %t.o | FileCheck %s --match-full-lines --strict-whitespace +# RUN: llvm-dwarfdump --debug-line %t.o --verbose | FileCheck %s --check-prefix=VERBOSE --match-full-lines --strict-whitespace -# HEADER: Address Line Column File ISA Discriminator Flags -# HEADER-NEXT: ------------------ ------ ------ ------ --- ------------- ------------- -# ROWS: 0x0000000012345678 1 0 1 0 1 is_stmt basic_block prologue_end epilogue_begin end_sequence -# ROWS: 0x0000000000000001 2 0 1 0 0 is_stmt -# ROWS: 0x0000000000000001 2 0 1 0 0 is_stmt end_sequence +# CHECK:Address Line Column File ISA Discriminator Flags +# CHECK-NEXT:------------------ ------ ------ ------ --- ------------- ------------- +# CHECK-NEXT:0x0000000012345678 1 0 1 0 1 is_stmt basic_block prologue_end epilogue_begin end_sequence +# CHECK-NEXT:0x0000000000000001 2 0 1 0 0 is_stmt +# CHECK-NEXT:0x0000000000000001 2 0 1 0 0 is_stmt end_sequence + +# VERBOSE: Address Line Column File ISA Discriminator Flags +# VERBOSE-NEXT: ------------------ ------ ------ ------ --- ------------- ------------- +# VERBOSE:0x00000044: 00 DW_LNE_end_sequence +# VERBOSE-NEXT: 0x0000000012345678 1 0 1 0 1 is_stmt basic_block prologue_end epilogue_begin end_sequence +# VERBOSE:0x00000047: 21 address += 1, line += 1 +# VERBOSE-NEXT: 0x0000000000000001 2 0 1 0 0 is_stmt +# VERBOSE:0x00000048: 00 DW_LNE_end_sequence +# VERBOSE-NEXT: 0x0000000000000001 2 0 1 0 0 is_stmt end_sequence .section .debug_line,"",@progbits .Line_table_start0: