summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Henderson <jh7370@my.bristol.ac.uk>2019-12-17 12:02:54 +0000
committerJames Henderson <jh7370@my.bristol.ac.uk>2019-12-17 12:04:09 +0000
commit5666b70fd0748765ecaa69950a4868cf23a16cc9 (patch)
tree5d81a48bd5a197c1d04a03deb1133efe6f4be704
parent67ce7f51a50f5fb4633fcdc0e80038d1f63a40f3 (diff)
downloadbcm5719-llvm-5666b70fd0748765ecaa69950a4868cf23a16cc9.tar.gz
bcm5719-llvm-5666b70fd0748765ecaa69950a4868cf23a16cc9.zip
[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
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp2
-rw-r--r--llvm/test/tools/llvm-dwarfdump/X86/debug-line.s31
2 files changed, 30 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 445f4bf48a7..f5b1c40024d 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 7184bc531c0..c83d49f0677 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,"",@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:
OpenPOWER on IntegriCloud