Revert "llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries"

Broke an LLDB build bot & I can't seem to build LLDB locally to fix
forward...
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/15567/steps/test/logs/stdio

This reverts commit 416fa7720e.
This commit is contained in:
David Blaikie 2020-04-11 16:53:26 -07:00
parent 61d39b627a
commit 7a45aeacf3
20 changed files with 48 additions and 52 deletions

View File

@ -156,7 +156,9 @@ bool DWARFLocationTable::dumpLocationList(uint64_t *Offset, raw_ostream &OS,
return true;
});
if (E) {
DumpOpts.RecoverableErrorHandler(std::move(E));
OS << "\n";
OS.indent(Indent);
OS << "error: " << toString(std::move(E));
return false;
}
return true;

View File

@ -1,20 +1,20 @@
# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE1=0 -o %t1.o
# RUN: not llvm-dwarfdump -debug-loc %t1.o 2>&1 | FileCheck %s
# RUN: 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: not llvm-dwarfdump -debug-loc %t2.o 2>&1 | FileCheck %s
# RUN: 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: not llvm-dwarfdump -debug-loc %t3.o 2>&1 | FileCheck %s
# RUN: 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: not llvm-dwarfdump -debug-loc %t4.o 2>&1 | FileCheck %s
# RUN: 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: not llvm-dwarfdump -debug-loc %t5.o 2>&1 | FileCheck %s
# RUN: 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: not llvm-dwarfdump -debug-loc %t6.o 2>&1 | FileCheck %s
# RUN: 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

View File

@ -1,6 +1,5 @@
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
# RUN: not llvm-dwarfdump %t 2>%t.err | FileCheck %s
# RUN: FileCheck %s < %t.err -check-prefix=ERR
# RUN: llvm-dwarfdump %t | FileCheck %s
# CHECK: DW_AT_name ("x0")
# CHECK-NEXT: DW_AT_location (0x00000000
@ -8,12 +7,12 @@
# CHECK-NEXT: [0x0000000000000002, 0x0000000000000003): DW_OP_reg0 RAX)
# CHECK: DW_AT_name ("x1")
# CHECK-NEXT: DW_AT_location (0xdeadbeef: )
# ERR: error: unexpected end of data at offset 0xdeadbeef
# CHECK-NEXT: DW_AT_location (0xdeadbeef
# CHECK-NEXT: error: unexpected end of data at offset 0xdeadbeef)
# CHECK: DW_AT_name ("x2")
# CHECK-NEXT: DW_AT_location (0x00000036: )
# ERR: error: unexpected end of data at offset 0x48
# CHECK-NEXT: DW_AT_location (0x00000036
# CHECK-NEXT: error: unexpected end of data at offset 0x48)
.type f,@function

View File

@ -1,23 +1,23 @@
# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE1=0 -o %t1.o
# RUN: not llvm-dwarfdump -debug-loclists %t1.o 2>&1 | FileCheck %s --check-prefix=ULEB
# RUN: 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: not llvm-dwarfdump -debug-loclists %t2.o 2>&1 | FileCheck %s --check-prefix=ULEB
# RUN: 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: not llvm-dwarfdump -debug-loclists %t3.o 2>&1 | FileCheck %s --check-prefix=ULEB
# RUN: 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: not llvm-dwarfdump -debug-loclists %t4.o 2>&1 | FileCheck %s
# RUN: 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: not llvm-dwarfdump -debug-loclists %t5.o 2>&1 | FileCheck %s
# RUN: 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: not llvm-dwarfdump -debug-loclists %t6.o 2>&1 | FileCheck %s
# RUN: 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: not llvm-dwarfdump -debug-loclists %t7.o 2>&1 | FileCheck %s --check-prefix=UNIMPL
# RUN: 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

View File

@ -1,6 +1,5 @@
# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
# RUN: not llvm-dwarfdump %t 2> %t.err | FileCheck %s
# RUN: FileCheck %s < %t.err -check-prefix=ERR
# RUN: not llvm-dwarfdump %t | FileCheck %s
# CHECK: DW_AT_name ("x0")
# CHECK-NEXT: DW_AT_location (0x0000000c
@ -8,12 +7,12 @@
# CHECK-NEXT: [0x0000000000000002, 0x0000000000000003): DW_OP_reg0 RAX)
# CHECK: DW_AT_name ("x1")
# CHECK-NEXT: DW_AT_location (0xdeadbeef: )
# ERR: error: unexpected end of data at offset 0xdeadbeef
# CHECK-NEXT: DW_AT_location (0xdeadbeef
# CHECK-NEXT: error: unexpected end of data at offset 0xdeadbeef)
# CHECK: DW_AT_name ("x2")
# CHECK-NEXT: DW_AT_location (0x00000025
# ERR: error: unexpected end of data at offset 0x34
# CHECK-NEXT: error: unexpected end of data at offset 0x34)
.type f,@function

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t
# RUN: not llvm-dwarfdump -v %t 2>%t.err | FileCheck %s
# RUN: llvm-dwarfdump -v %t 2>%t.err | FileCheck %s
# RUN: FileCheck %s <%t.err -check-prefix=ERR
# CHECK: .debug_info contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: not llvm-dwarfdump -v %t.o 2>&1 | FileCheck --check-prefix=OVERLAP %s
# RUN: 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.

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: FileCheck %s -input-file %t.err -check-prefix=ERR
# CHECK: .debug_addr contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: FileCheck %s -input-file %t.err -check-prefix=ERR
# CHECK: .debug_addr contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o - | \
# RUN: not llvm-dwarfdump --debug-addr - 2>&1 | \
# RUN: 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

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: FileCheck %s -input-file %t.err -check-prefix=ERR
# CHECK: .debug_addr contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: FileCheck %s -input-file %t.err -check-prefix=ERR
# CHECK: .debug_addr contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: FileCheck %s -input-file %t.err -check-prefix=ERR
# CHECK: .debug_addr contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: FileCheck %s -input-file %t.err -check-prefix=ERR
# CHECK: .debug_addr contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: FileCheck %s -input-file %t.err -check-prefix=ERR
# CHECK: .debug_addr contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: not llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: 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

View File

@ -1,8 +1,7 @@
# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o
# 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: 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: 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

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %S/Inputs/debug_rnglists_short_section.s -filetype obj -triple x86_64-pc-linux -o - | \
# RUN: not llvm-dwarfdump --debug-rnglists - 2>&1 | FileCheck %s --check-prefix=SHORT
# RUN: 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: not llvm-dwarfdump --debug-rnglists - 2> %t.err | FileCheck %s --check-prefix=GOOD
# RUN: llvm-dwarfdump --debug-rnglists - 2> %t.err | FileCheck %s --check-prefix=GOOD
# RUN: FileCheck %s --input-file %t.err
# GOOD: .debug_rnglists contents:

View File

@ -1,5 +1,5 @@
# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o - | \
# RUN: not llvm-dwarfdump --debug-rnglists - 2>&1 | \
# RUN: 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

View File

@ -243,7 +243,7 @@ static void error(StringRef Prefix, std::error_code EC) {
exit(1);
}
static DIDumpOptions getDumpOpts(DWARFContext& C) {
static DIDumpOptions getDumpOpts() {
DIDumpOptions DumpOpts;
DumpOpts.DumpType = DumpType;
DumpOpts.ChildRecurseDepth = ChildRecurseDepth;
@ -254,7 +254,6 @@ static DIDumpOptions getDumpOpts(DWARFContext& C) {
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();
@ -295,7 +294,6 @@ using HandlerFn = std::function<bool(ObjectFile &, DWARFContext &DICtx,
/// Print only DIEs that have a certain name.
static bool filterByName(const StringSet<> &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) {
@ -308,13 +306,13 @@ static bool filterByName(const StringSet<> &Names, DWARFDie Die,
exit(1);
}
if (RE.match(Name)) {
Die.dump(OS, 0, DumpOpts);
Die.dump(OS, 0, getDumpOpts());
return true;
}
}
} else if (Names.count(Name)) {
// Match full text.
Die.dump(OS, 0, DumpOpts);
Die.dump(OS, 0, getDumpOpts());
return true;
}
return false;
@ -387,9 +385,8 @@ static void filterByAccelName(ArrayRef<std::string> 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, DumpOpts);
Die.dump(OS, 0, getDumpOpts());
}
/// Handle the --lookup option and dump the DIEs and line info for the given
@ -405,7 +402,7 @@ static bool lookup(ObjectFile &Obj, DWARFContext &DICtx, uint64_t Address,
if (!DIEsForAddr)
return false;
DIDumpOptions DumpOpts = getDumpOpts(DICtx);
DIDumpOptions DumpOpts = getDumpOpts();
DumpOpts.ChildRecurseDepth = 0;
DIEsForAddr.CompileUnit->dump(OS, DumpOpts);
if (DIEsForAddr.FunctionDIE) {
@ -453,7 +450,7 @@ static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
}
// Dump the complete DWARF structure.
DICtx.dump(OS, getDumpOpts(DICtx), DumpOffsets);
DICtx.dump(OS, getDumpOpts(), DumpOffsets);
return true;
}
@ -464,7 +461,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(DICtx));
bool Result = DICtx.verify(stream, getDumpOpts());
if (Result)
stream << "No errors.\n";
else