[llvm] 5666b70 - [DebugInfo] Only print a single blank line after an empty line table

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 04:05:11 PST 2019


Author: James Henderson
Date: 2019-12-17T12:04:09Z
New Revision: 5666b70fd0748765ecaa69950a4868cf23a16cc9

URL: https://github.com/llvm/llvm-project/commit/5666b70fd0748765ecaa69950a4868cf23a16cc9
DIFF: https://github.com/llvm/llvm-project/commit/5666b70fd0748765ecaa69950a4868cf23a16cc9.diff

LOG: [DebugInfo] Only print a single blank line after an empty line table

Commit 84a9756 added an extra blank line at the end of any line table.
However, a blank line is also printed after the line table header, which
meant that two blank lines in a row were being printed after a header,
if there were no rows. This patch defers the post-header blank line
printing until it has been determined that there are rows to print.

Reviewed by: dblaikie

Differential Revision: https://reviews.llvm.org/D71540

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/test/tools/llvm-dwarfdump/X86/debug-line.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 445f4bf48a71..f5b1c40024d3 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -453,9 +453,9 @@ DWARFDebugLine::LineTable::LineTable() { clear(); }
 void DWARFDebugLine::LineTable::dump(raw_ostream &OS,
                                      DIDumpOptions DumpOptions) const {
   Prologue.dump(OS, DumpOptions);
-  OS << '\n';
 
   if (!Rows.empty()) {
+    OS << '\n';
     Row::dumpTableHeader(OS);
     for (const Row &R : Rows) {
       R.dump(OS);

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-line.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-line.s
index 7184bc531c09..c83d49f06775 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug-line.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-line.s
@@ -62,7 +62,8 @@
 # CHECK-NEXT:       dir_index: 1
 # CHECK-NEXT:        mod_time: 0x00000011
 # CHECK-NEXT:          length: 0x00000022
-# CHECK-NOT:  {{.}}
+# CHECK-EMPTY:
+# CHECK-NEXT: debug_line[0x0000008c]
 
 .section .debug_line,"", at progbits
     .long .Lunit0_end - .Lunit0_begin ## unit_length
@@ -120,7 +121,7 @@
     .byte 0, 0x1, 0x1 ## DW_LNE_end_sequence
 .Lunit0_end:
 
-## Second line table program with version 4.
+## Second line table program with version 4 and no sequences.
     .long .Lunit1_end - .Lunit1_begin ## unit_length
 .Lunit1_begin:
     .short 4 ## version
@@ -143,3 +144,29 @@
     .byte 0x22 ## Length
 .Lheader1_end:
 .Lunit1_end:
+
+## Third line table program needed to show that only a single blank line is
+## printed after a program with no sequences. The values in this table are
+## arbitrary.
+    .long .Lunit2_end - .Lunit2_begin ## unit_length
+.Lunit2_begin:
+    .short 4 ## version
+    .long .Lheader2_end - .Lheader2_begin ## header_length
+.Lheader2_begin:
+    .byte 1 ## minimum_instruction_length
+    .byte 2 ## maximum_operations_per_instruction
+    .byte 1 ## default_is_stmt
+    .byte 1 ## line_base
+    .byte 1 ## line_range
+    .byte 2 ## opcode_base
+    .byte 1 ## standard_opcode_lengths
+    ## include_directories
+    .byte 0
+    ## file_names
+    .asciz "bar.c"
+    .byte 0 ## Directory index
+    .byte 0 ## Timestamp
+    .byte 0 ## Length
+.Lheader2_end:
+    .byte 0, 0x1, 0x1 ## DW_LNE_end_sequence
+.Lunit2_end:


        


More information about the llvm-commits mailing list