From 6d6a4920f5a2022d368d48de824cd87e96a3dac8 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Wed, 22 Nov 2017 18:23:55 +0000 Subject: [PATCH] [DwarfDump] -debug-line=offset applies to .dwo too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318856 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARF/DWARFContext.cpp | 4 +- test/DebugInfo/Inputs/dwarfdump-line-dwo.cc | 10 -- .../Inputs/dwarfdump-line-dwo.elf-x86-64 | Bin 1377 -> 0 bytes test/DebugInfo/X86/dwarfdump-line-dwo.s | 97 ++++++++++++++++++ test/DebugInfo/dwarfdump-line-dwo.test | 6 -- 5 files changed, 100 insertions(+), 17 deletions(-) delete mode 100644 test/DebugInfo/Inputs/dwarfdump-line-dwo.cc delete mode 100644 test/DebugInfo/Inputs/dwarfdump-line-dwo.elf-x86-64 create mode 100644 test/DebugInfo/X86/dwarfdump-line-dwo.s delete mode 100644 test/DebugInfo/dwarfdump-line-dwo.test diff --git a/lib/DebugInfo/DWARF/DWARFContext.cpp b/lib/DebugInfo/DWARF/DWARFContext.cpp index cd7a81fe892..5893f223c07 100644 --- a/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -379,9 +379,11 @@ void DWARFContext::dump( if (It != LineToUnit.end()) U = It->second; DWARFDebugLine::LineTable LineTable; + unsigned OldOffset = Offset; if (!LineTable.Prologue.parse(LineData, &Offset, U)) break; - LineTable.dump(OS); + if (!DumpOffset || OldOffset == *DumpOffset) + LineTable.dump(OS); } } diff --git a/test/DebugInfo/Inputs/dwarfdump-line-dwo.cc b/test/DebugInfo/Inputs/dwarfdump-line-dwo.cc deleted file mode 100644 index 2784ae24ee5..00000000000 --- a/test/DebugInfo/Inputs/dwarfdump-line-dwo.cc +++ /dev/null @@ -1,10 +0,0 @@ -struct foo { -}; - -foo f; - -// Built with GCC -// $ mkdir -p /tmp/dbginfo -// $ cp dwarfdump-line-dwo.cc /tmp/dbginfo -// $ cd /tmp/dbginfo -// $ g++ -c -fdebug-types-section dwarfdump-line-dwo.cc -o diff --git a/test/DebugInfo/Inputs/dwarfdump-line-dwo.elf-x86-64 b/test/DebugInfo/Inputs/dwarfdump-line-dwo.elf-x86-64 deleted file mode 100644 index 9f1d267dde1e0f1e63af002710a37ac2c3aa5b21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1377 zcmb`H&ui2`6vtnF=+*|IWyK#9BnOL?HR-l4wN<;W6%|2x5IlHs-AyLj;N}NO)@=`B zSUjnq(0@Wa2;MyT2Y3+_Pl5+eo)x@!&^O8KW|+;xB?-nu zf+iGdOaa#AB5q}23ud7Lr!iJDJ@c2`{_yFm^JNjGr0)NE|4laUey4k~Dq)LL7%{6N zsUZJ&{c)~s4xg#0#<}tz%)KI2wHI5Jxnr1F1!dIKve*+c)*gC*^)+Lyp&Pw8?7Io}$K&XRW0UTnXC!+eiH(?8i5vK^oOt1~-R-%)6MzFw5CE9* zo|kmGxF%7)?u?_XL^~^C;%kAK1Deh2PPZG8hdiMlg4bBE9XL)*l32i*#Lw~{#sbzT z`<=B|?V8X-^qwv9Q{MW3i6tIlEaqP-Sjt=XnP~A4V=;fbU@33?%*1&fVl3w0D_F`~ zXPNN`4-4;v4hoh|AO diff --git a/test/DebugInfo/X86/dwarfdump-line-dwo.s b/test/DebugInfo/X86/dwarfdump-line-dwo.s new file mode 100644 index 00000000000..b2b780285ab --- /dev/null +++ b/test/DebugInfo/X86/dwarfdump-line-dwo.s @@ -0,0 +1,97 @@ +# Dump the complete .debug_line.dwo, then just one part. +# +# RUN: llvm-mc -triple x86_64-unknown-unknown -filetype=obj %s -o %t.o +# RUN: llvm-dwarfdump -debug-line %t.o | FileCheck %s --check-prefixes=PART1,PART2 +# RUN: llvm-dwarfdump -debug-line=0x32 %t.o | FileCheck %s --check-prefix=PART2 + + .section .debug_line.dwo,"",@progbits +LH_1_start: + .long LH_1_end-LH_1_version # Length of Unit +LH_1_version: + .short 4 # DWARF version number + .long LH_1_header_end-LH_1_params # Length of Prologue +LH_1_params: + .byte 1 # Minimum Instruction Length + .byte 1 # Maximum Operations per Instruction + .byte 1 # Default is_stmt + .byte -5 # Line Base + .byte 14 # Line Range + .byte 13 # Opcode Base + .byte 0 # Standard Opcode Lengths + .byte 1 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .byte 0 + .byte 0 + .byte 1 + .byte 0 + .byte 0 + .byte 1 + # Directory table + .asciz "Directory1" + .byte 0 + # File table + .asciz "File1" # File name + .byte 1 # Directory index + .byte 0x41 # Timestamp + .byte 0x42 # File Size + .byte 0 # End of list +LH_1_header_end: + # Line number program, which is empty. +LH_1_end: + +# PART1: Line table prologue: +# PART1-NEXT: total_length: 0x0000002e +# PART1-NEXT: version: 4 +# PART1-NEXT: prologue_length: 0x00000028 +# PART1: include_directories[ 1] = 'Directory1' +# PART1: file_names[ 1] {{.*}} File1 + +# Second line table. +LH_2_start: + .long LH_2_end-LH_2_version # Length of Unit +LH_2_version: + .short 4 # DWARF version number + .long LH_2_header_end-LH_2_params # Length of Prologue +LH_2_params: + .byte 1 # Minimum Instruction Length + .byte 1 # Maximum Operations per Instruction + .byte 1 # Default is_stmt + .byte -5 # Line Base + .byte 14 # Line Range + .byte 13 # Opcode Base + .byte 0 # Standard Opcode Lengths + .byte 1 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .byte 0 + .byte 0 + .byte 1 + .byte 0 + .byte 0 + .byte 1 + # Directory table + .asciz "Dir2" + .byte 0 + # File table + .asciz "File2" # File name + .byte 1 # Directory index + .byte 0x14 # Timestamp + .byte 0x24 # File Size + .byte 0 # End of list +LH_2_header_end: + # Line number program, which is empty. +LH_2_end: + +# PART2: Line table prologue: +# PART2-NEXT: total_length: 0x00000028 +# PART2-NEXT: version: 4 +# PART2-NEXT: prologue_length: 0x00000022 +# PART2-NOT: prologue: +# PART2: include_directories[ 1] = 'Dir2' +# PART2: file_names[ 1] {{.*}} File2 +# PART2-NOT: prologue: diff --git a/test/DebugInfo/dwarfdump-line-dwo.test b/test/DebugInfo/dwarfdump-line-dwo.test deleted file mode 100644 index 491728e0e2e..00000000000 --- a/test/DebugInfo/dwarfdump-line-dwo.test +++ /dev/null @@ -1,6 +0,0 @@ -RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-line-dwo.elf-x86-64 | FileCheck %s - -CHECK: .debug_line.dwo contents: -CHECK: version: 4 -CHECK: max_ops_per_inst: 1 -CHECK: file_names[ 1]{{.*}}dwarfdump-line-dwo.cc -- 2.50.1