From 65b8c0fe7a58b803fdf8cea386bb04e87c47aaef Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 19 Oct 2018 17:57:53 +0000 Subject: [PATCH] [dwarfdump] Hide ranges in diff-mode. llvm-dwarfdump --diff should not print DW_AT_ranges. This patch fixes that. Differential revision: https://reviews.llvm.org/D53353 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344794 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARF/DWARFDie.cpp | 4 +++- test/DebugInfo/X86/dwarfdump-ranges-unrelocated.s | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/DebugInfo/DWARF/DWARFDie.cpp b/lib/DebugInfo/DWARF/DWARFDie.cpp index 35567d0f67a..cf10c1134a7 100644 --- a/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -59,12 +59,14 @@ static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS, const DWARFAddressRangesVector &Ranges, unsigned AddressSize, unsigned Indent, const DIDumpOptions &DumpOpts) { + if (!DumpOpts.ShowAddresses) + return; + ArrayRef SectionNames; if (DumpOpts.Verbose) SectionNames = Obj.getSectionNames(); for (const DWARFAddressRange &R : Ranges) { - OS << '\n'; OS.indent(Indent); R.dump(OS, AddressSize); diff --git a/test/DebugInfo/X86/dwarfdump-ranges-unrelocated.s b/test/DebugInfo/X86/dwarfdump-ranges-unrelocated.s index 2bb46707cc8..d779dac1a41 100644 --- a/test/DebugInfo/X86/dwarfdump-ranges-unrelocated.s +++ b/test/DebugInfo/X86/dwarfdump-ranges-unrelocated.s @@ -21,6 +21,16 @@ # BRIEF-NEXT: [0x0000000000000000, 0x0000000000000002) # BRIEF-NEXT: [0x0000000000000000, 0x0000000000000003)) +# RUN: llvm-dwarfdump -diff %t | FileCheck %s --check-prefix=DIFF +# DIFF: DW_TAG_compile_unit +# DIFF-NEXT: DW_AT_producer () +# DIFF-NEXT: DW_AT_language (DW_LANG_C_plus_plus) +# DIFF-NEXT: DW_AT_name () +# DIFF-NEXT: DW_AT_stmt_list () +# DIFF-NEXT: DW_AT_comp_dir () +# DIFF-NEXT: DW_AT_low_pc () +# DIFF-NEXT: DW_AT_ranges () + ## Asm code for testcase is a reduced and modified output from next ## invocation and source: # clang test.cpp -S -o test.s -gmlt -ffunction-sections