From 7a82cffd68bccfea62762873375e30503dcc0bf8 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Wed, 28 Jun 2017 07:06:17 +0000 Subject: Revert r306512 "[ELF] - Add ability for DWARFContextInMemory to exit early when any error happen." It broke BB: [13/106] 13 0.022 Generating VCSRevision.h [25/106] 24 1.209 Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o FAILED: unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o /home/bb/bin/g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iunittests/DebugInfo/DWARF -I../llvm-project/llvm/unittests/DebugInfo/DWARF -Iinclude -I../llvm-project/llvm/include -I../llvm-project/llvm/utils/unittest/googletest/include -I../llvm-project/llvm/utils/unittest/googlemock/include -fPIC -fvisibility-inlines-hidden -m32 -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -UNDEBUG -Wno-variadic-macros -fno-exceptions -fno-rtti -MD -MT unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o -MF unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o.d -o unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o -c ../llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp ../llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:18:37: fatal error: llvm/Codegen/AsmPrinter.h: No such file or directory #include "llvm/Codegen/AsmPrinter.h" ^ compilation terminated. llvm-svn: 306513 --- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'llvm/lib/DebugInfo') diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index fdd191e0cbf..38147946175 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -870,13 +870,13 @@ static Expected getSymbolInfo(const object::ObjectFile &Obj, Expected SymAddrOrErr = Sym->getAddress(); if (!SymAddrOrErr) - return createError("failed to compute symbol address: ", + return createError("error: failed to compute symbol address: ", SymAddrOrErr.takeError()); // Also remember what section this symbol is in for later auto SectOrErr = Sym->getSection(); if (!SectOrErr) - return createError("failed to get symbol section: ", + return createError("error: failed to get symbol section: ", SectOrErr.takeError()); RSec = *SectOrErr; @@ -937,14 +937,8 @@ Error DWARFContextInMemory::maybeDecompress(const SectionRef &Sec, return Error::success(); } -ErrorPolicy DWARFContextInMemory::defaultErrorHandler(Error E) { - errs() << "error: " + toString(std::move(E)) << '\n'; - return ErrorPolicy::Continue; -} - -DWARFContextInMemory::DWARFContextInMemory( - const object::ObjectFile &Obj, const LoadedObjectInfo *L, - function_ref HandleError) +DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj, + const LoadedObjectInfo *L) : FileName(Obj.getFileName()), IsLittleEndian(Obj.isLittleEndian()), AddressSize(Obj.getBytesInAddress()) { for (const SectionRef &Section : Obj.sections()) { @@ -967,10 +961,9 @@ DWARFContextInMemory::DWARFContextInMemory( Section.getContents(data); if (auto Err = maybeDecompress(Section, name, data)) { - ErrorPolicy EP = HandleError( - createError("failed to decompress '" + name + "', ", std::move(Err))); - if (EP == ErrorPolicy::Halt) - return; + errs() << "error: failed to decompress '" + name + "', " + + toString(std::move(Err)) + << '\n'; continue; } @@ -1062,8 +1055,7 @@ DWARFContextInMemory::DWARFContextInMemory( Expected SymInfoOrErr = getSymbolInfo(Obj, Reloc, L, AddrCache); if (!SymInfoOrErr) { - if (HandleError(SymInfoOrErr.takeError()) == ErrorPolicy::Halt) - return; + errs() << toString(SymInfoOrErr.takeError()) << '\n'; continue; } @@ -1072,11 +1064,7 @@ DWARFContextInMemory::DWARFContextInMemory( if (V.error()) { SmallString<32> Name; Reloc.getTypeName(Name); - ErrorPolicy EP = HandleError( - createError("failed to compute relocation: " + name + ", ", - errorCodeToError(object_error::parse_failed))); - if (EP == ErrorPolicy::Halt) - return; + errs() << "error: failed to compute relocation: " << Name << "\n"; continue; } RelocAddrEntry Rel = {SymInfoOrErr->SectionIndex, Val}; -- cgit v1.2.3