From: David Blaikie Date: Sat, 11 Apr 2020 00:26:11 +0000 (-0700) Subject: llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=416fa7720e30750939c53935051c6c750dfad2c2;p=platform%2Fupstream%2Fllvm.git llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries This probably isn't ideal - the error was being printed specifically inline with the dumping that was more legible - but then the error wasn't reported to stderr and didn't produce a non-zero exit code. Probably the error message could be improved by adding more context now that it isn't printed in-situ of the DIE dumping as much. --- diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp index 8f047bb..17f0b7f 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp @@ -156,9 +156,7 @@ bool DWARFLocationTable::dumpLocationList(uint64_t *Offset, raw_ostream &OS, return true; }); if (E) { - OS << "\n"; - OS.indent(Indent); - OS << "error: " << toString(std::move(E)); + DumpOpts.RecoverableErrorHandler(std::move(E)); return false; } return true; diff --git a/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s b/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s index 5ee701b..b623894 100644 --- a/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s +++ b/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s @@ -1,20 +1,20 @@ # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE1=0 -o %t1.o -# RUN: llvm-dwarfdump -debug-loc %t1.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loc %t1.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE2=0 -o %t2.o -# RUN: llvm-dwarfdump -debug-loc %t2.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loc %t2.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE3=0 -o %t3.o -# RUN: llvm-dwarfdump -debug-loc %t3.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loc %t3.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE4=0 -o %t4.o -# RUN: llvm-dwarfdump -debug-loc %t4.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loc %t4.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE5=0 -o %t5.o -# RUN: llvm-dwarfdump -debug-loc %t5.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loc %t5.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE6=0 -o %t6.o -# RUN: llvm-dwarfdump -debug-loc %t6.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loc %t6.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE7=0 -o %t7.o # RUN: llvm-dwarfdump -debug-loc %t7.o 2>&1 | FileCheck %s --check-prefix=UNKNOWN-REG diff --git a/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases2.s b/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases2.s index 7e951e5..8a1abd6 100644 --- a/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases2.s +++ b/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases2.s @@ -1,5 +1,6 @@ # RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t -# RUN: llvm-dwarfdump %t | FileCheck %s +# RUN: not llvm-dwarfdump %t 2>%t.err | FileCheck %s +# RUN: FileCheck %s < %t.err -check-prefix=ERR # CHECK: DW_AT_name ("x0") # CHECK-NEXT: DW_AT_location (0x00000000 @@ -7,12 +8,12 @@ # CHECK-NEXT: [0x0000000000000002, 0x0000000000000003): DW_OP_reg0 RAX) # CHECK: DW_AT_name ("x1") -# CHECK-NEXT: DW_AT_location (0xdeadbeef -# CHECK-NEXT: error: unexpected end of data at offset 0xdeadbeef) +# CHECK-NEXT: DW_AT_location (0xdeadbeef: ) +# ERR: error: unexpected end of data at offset 0xdeadbeef # CHECK: DW_AT_name ("x2") -# CHECK-NEXT: DW_AT_location (0x00000036 -# CHECK-NEXT: error: unexpected end of data at offset 0x48) +# CHECK-NEXT: DW_AT_location (0x00000036: ) +# ERR: error: unexpected end of data at offset 0x48 .type f,@function diff --git a/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases.s b/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases.s index bb83684..0481049 100644 --- a/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases.s +++ b/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases.s @@ -1,23 +1,23 @@ # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE1=0 -o %t1.o -# RUN: llvm-dwarfdump -debug-loclists %t1.o 2>&1 | FileCheck %s --check-prefix=ULEB +# RUN: not llvm-dwarfdump -debug-loclists %t1.o 2>&1 | FileCheck %s --check-prefix=ULEB # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE2=0 -o %t2.o -# RUN: llvm-dwarfdump -debug-loclists %t2.o 2>&1 | FileCheck %s --check-prefix=ULEB +# RUN: not llvm-dwarfdump -debug-loclists %t2.o 2>&1 | FileCheck %s --check-prefix=ULEB # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE3=0 -o %t3.o -# RUN: llvm-dwarfdump -debug-loclists %t3.o 2>&1 | FileCheck %s --check-prefix=ULEB +# RUN: not llvm-dwarfdump -debug-loclists %t3.o 2>&1 | FileCheck %s --check-prefix=ULEB # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE4=0 -o %t4.o -# RUN: llvm-dwarfdump -debug-loclists %t4.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loclists %t4.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE5=0 -o %t5.o -# RUN: llvm-dwarfdump -debug-loclists %t5.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loclists %t5.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE6=0 -o %t6.o -# RUN: llvm-dwarfdump -debug-loclists %t6.o 2>&1 | FileCheck %s +# RUN: not llvm-dwarfdump -debug-loclists %t6.o 2>&1 | FileCheck %s # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE7=0 -o %t7.o -# RUN: llvm-dwarfdump -debug-loclists %t7.o 2>&1 | FileCheck %s --check-prefix=UNIMPL +# RUN: not llvm-dwarfdump -debug-loclists %t7.o 2>&1 | FileCheck %s --check-prefix=UNIMPL # CHECK: error: unexpected end of data # ULEB: error: malformed uleb128, extends past end diff --git a/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases2.s b/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases2.s index f15d071..14dc7f4 100644 --- a/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases2.s +++ b/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases2.s @@ -1,5 +1,6 @@ # RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t -# RUN: not llvm-dwarfdump %t | FileCheck %s +# RUN: not llvm-dwarfdump %t 2> %t.err | FileCheck %s +# RUN: FileCheck %s < %t.err -check-prefix=ERR # CHECK: DW_AT_name ("x0") # CHECK-NEXT: DW_AT_location (0x0000000c @@ -7,12 +8,12 @@ # CHECK-NEXT: [0x0000000000000002, 0x0000000000000003): DW_OP_reg0 RAX) # CHECK: DW_AT_name ("x1") -# CHECK-NEXT: DW_AT_location (0xdeadbeef -# CHECK-NEXT: error: unexpected end of data at offset 0xdeadbeef) +# CHECK-NEXT: DW_AT_location (0xdeadbeef: ) +# ERR: error: unexpected end of data at offset 0xdeadbeef # CHECK: DW_AT_name ("x2") # CHECK-NEXT: DW_AT_location (0x00000025 -# CHECK-NEXT: error: unexpected end of data at offset 0x34) +# ERR: error: unexpected end of data at offset 0x34 .type f,@function diff --git a/llvm/test/DebugInfo/X86/dwarfdump-ranges-baseaddr.s b/llvm/test/DebugInfo/X86/dwarfdump-ranges-baseaddr.s index 7d5a6f9..22254b9 100644 --- a/llvm/test/DebugInfo/X86/dwarfdump-ranges-baseaddr.s +++ b/llvm/test/DebugInfo/X86/dwarfdump-ranges-baseaddr.s @@ -1,5 +1,5 @@ # RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t -# RUN: llvm-dwarfdump -v %t 2>%t.err | FileCheck %s +# RUN: not llvm-dwarfdump -v %t 2>%t.err | FileCheck %s # RUN: FileCheck %s <%t.err -check-prefix=ERR # CHECK: .debug_info contents: diff --git a/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-invalid-6.s b/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-invalid-6.s index 01bc39c..6b8c669 100644 --- a/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-invalid-6.s +++ b/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-invalid-6.s @@ -1,5 +1,5 @@ # RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o -# RUN: llvm-dwarfdump -v %t.o 2>&1 | FileCheck --check-prefix=OVERLAP %s +# RUN: not llvm-dwarfdump -v %t.o 2>&1 | FileCheck --check-prefix=OVERLAP %s # # Test object to verify that llvm-dwarfdump handles an invalid string offsets # table with overlapping contributions. diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_not_multiple.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_not_multiple.s index d758709..dd0c46f 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_not_multiple.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_not_multiple.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \ -# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s +# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s # RUN: FileCheck %s -input-file %t.err -check-prefix=ERR # CHECK: .debug_addr contents: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_invalid_addr_size.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_invalid_addr_size.s index 0ad055b..2638471 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_invalid_addr_size.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_invalid_addr_size.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \ -# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s +# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s # RUN: FileCheck %s -input-file %t.err -check-prefix=ERR # CHECK: .debug_addr contents: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_reserved_length.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_reserved_length.s index 125be83..aaedf7f 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_reserved_length.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_reserved_length.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o - | \ -# RUN: llvm-dwarfdump --debug-addr - 2>&1 | \ +# RUN: not llvm-dwarfdump --debug-addr - 2>&1 | \ # RUN: FileCheck %s --implicit-check-not=error # CHECK: error: parsing address table at offset 0x0: unsupported reserved unit length of value 0xfffffff0 diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_segment_selector.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_segment_selector.s index 3200b4f..5207951 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_segment_selector.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_segment_selector.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \ -# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s +# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s # RUN: FileCheck %s -input-file %t.err -check-prefix=ERR # CHECK: .debug_addr contents: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_small_length_field.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_small_length_field.s index 3b12737..b487533 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_small_length_field.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_small_length_field.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \ -# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s +# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s # RUN: FileCheck %s -input-file %t.err -check-prefix=ERR # CHECK: .debug_addr contents: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_extended_length_field.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_extended_length_field.s index 8ac3cc5..1034c97 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_extended_length_field.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_extended_length_field.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \ -# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s +# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s # RUN: FileCheck %s -input-file %t.err -check-prefix=ERR # CHECK: .debug_addr contents: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_length_field.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_length_field.s index 1a51541..bc840eb 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_length_field.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_length_field.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \ -# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s +# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s # RUN: FileCheck %s -input-file %t.err -check-prefix=ERR # CHECK: .debug_addr contents: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_section.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_section.s index 5bd9061..4de8df4 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_section.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_too_small_for_section.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \ -# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s +# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s # RUN: FileCheck %s -input-file %t.err -check-prefix=ERR # CHECK: .debug_addr contents: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s index 4eeeaa7..dec91fe 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \ -# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s +# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s # RUN: FileCheck %s -input-file %t.err -check-prefix=ERR # ERR: address table at offset 0x0 has unsupported version 6 diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s index 60533ca..650fc1a 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s @@ -1,7 +1,8 @@ # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o -# RUN: llvm-dwarfdump --debug-rnglists %t.o 2> %t.err | FileCheck %s --check-prefixes=TERSE,BOTH +# RUN: not llvm-dwarfdump --debug-rnglists %t.o 2> %t.err | FileCheck %s --check-prefixes=TERSE,BOTH +# RUN: FileCheck %s --input-file %t.err --check-prefix=ERR +# RUN: not llvm-dwarfdump -v --debug-rnglists %t.o 2> %t.err | FileCheck %s --check-prefixes=VERBOSE,BOTH # RUN: FileCheck %s --input-file %t.err --check-prefix=ERR -# RUN: llvm-dwarfdump -v --debug-rnglists %t.o 2> %t.err | FileCheck %s --check-prefixes=VERBOSE,BOTH # BOTH: .debug_rnglists contents: # TERSE-NEXT: range list header: length = 0x00000037, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_invalid.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_invalid.s index b11a2cc..6406047 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_invalid.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_invalid.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %S/Inputs/debug_rnglists_short_section.s -filetype obj -triple x86_64-pc-linux -o - | \ -# RUN: llvm-dwarfdump --debug-rnglists - 2>&1 | FileCheck %s --check-prefix=SHORT +# RUN: not llvm-dwarfdump --debug-rnglists - 2>&1 | FileCheck %s --check-prefix=SHORT # SHORT-NOT: error: # SHORT-NOT: range list header # SHORT: error: parsing .debug_rnglists table at offset 0x0: unexpected end of data at offset 0x0 @@ -7,7 +7,7 @@ # SHORT-NOT: error: # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o - | \ -# RUN: llvm-dwarfdump --debug-rnglists - 2> %t.err | FileCheck %s --check-prefix=GOOD +# RUN: not llvm-dwarfdump --debug-rnglists - 2> %t.err | FileCheck %s --check-prefix=GOOD # RUN: FileCheck %s --input-file %t.err # GOOD: .debug_rnglists contents: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_reserved_length.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_reserved_length.s index 7db4aef..27c30d9 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_reserved_length.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists_reserved_length.s @@ -1,5 +1,5 @@ # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o - | \ -# RUN: llvm-dwarfdump --debug-rnglists - 2>&1 | \ +# RUN: not llvm-dwarfdump --debug-rnglists - 2>&1 | \ # RUN: FileCheck %s --implicit-check-not=error # CHECK: error: parsing .debug_rnglists table at offset 0x0: unsupported reserved unit length of value 0xfffffff0 diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 14115c8..31de753 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -243,7 +243,7 @@ static void error(StringRef Prefix, std::error_code EC) { exit(1); } -static DIDumpOptions getDumpOpts() { +static DIDumpOptions getDumpOpts(DWARFContext& C) { DIDumpOptions DumpOpts; DumpOpts.DumpType = DumpType; DumpOpts.ChildRecurseDepth = ChildRecurseDepth; @@ -254,6 +254,7 @@ static DIDumpOptions getDumpOpts() { DumpOpts.ShowForm = ShowForm; DumpOpts.SummarizeTypes = SummarizeTypes; DumpOpts.Verbose = Verbose; + DumpOpts.RecoverableErrorHandler = C.getRecoverableErrorHandler(); // In -verify mode, print DIEs without children in error messages. if (Verify) return DumpOpts.noImplicitRecursion(); @@ -294,6 +295,7 @@ using HandlerFn = std::function &Names, DWARFDie Die, StringRef NameRef, raw_ostream &OS) { + DIDumpOptions DumpOpts = getDumpOpts(Die.getDwarfUnit()->getContext()); std::string Name = (IgnoreCase && !UseRegex) ? NameRef.lower() : NameRef.str(); if (UseRegex) { @@ -306,13 +308,13 @@ static bool filterByName(const StringSet<> &Names, DWARFDie Die, exit(1); } if (RE.match(Name)) { - Die.dump(OS, 0, getDumpOpts()); + Die.dump(OS, 0, DumpOpts); return true; } } } else if (Names.count(Name)) { // Match full text. - Die.dump(OS, 0, getDumpOpts()); + Die.dump(OS, 0, DumpOpts); return true; } return false; @@ -385,8 +387,9 @@ static void filterByAccelName(ArrayRef Names, DWARFContext &DICtx, llvm::sort(Dies); Dies.erase(std::unique(Dies.begin(), Dies.end()), Dies.end()); + DIDumpOptions DumpOpts = getDumpOpts(DICtx); for (DWARFDie Die : Dies) - Die.dump(OS, 0, getDumpOpts()); + Die.dump(OS, 0, DumpOpts); } /// Handle the --lookup option and dump the DIEs and line info for the given @@ -402,7 +405,7 @@ static bool lookup(ObjectFile &Obj, DWARFContext &DICtx, uint64_t Address, if (!DIEsForAddr) return false; - DIDumpOptions DumpOpts = getDumpOpts(); + DIDumpOptions DumpOpts = getDumpOpts(DICtx); DumpOpts.ChildRecurseDepth = 0; DIEsForAddr.CompileUnit->dump(OS, DumpOpts); if (DIEsForAddr.FunctionDIE) { @@ -450,7 +453,7 @@ static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, } // Dump the complete DWARF structure. - DICtx.dump(OS, getDumpOpts(), DumpOffsets); + DICtx.dump(OS, getDumpOpts(DICtx), DumpOffsets); return true; } @@ -461,7 +464,7 @@ static bool verifyObjectFile(ObjectFile &Obj, DWARFContext &DICtx, raw_ostream &stream = Quiet ? nulls() : OS; stream << "Verifying " << Filename.str() << ":\tfile format " << Obj.getFileFormatName() << "\n"; - bool Result = DICtx.verify(stream, getDumpOpts()); + bool Result = DICtx.verify(stream, getDumpOpts(DICtx)); if (Result) stream << "No errors.\n"; else