[lld] r368378 - DebugInfo: Explicitly handle errors when parsing unit DIEs
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 18:14:37 PDT 2019
Author: dblaikie
Date: Thu Aug 8 18:14:36 2019
New Revision: 368378
URL: http://llvm.org/viewvc/llvm-project?rev=368378&view=rev
Log:
DebugInfo: Explicitly handle errors when parsing unit DIEs
This ensures these errors produce a non-zero exit and improves the
context (providing the name of the input object and section being
parsed).
Modified:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/test/ELF/gdb-index-parse-fail.s
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=368378&r1=368377&r2=368378&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu Aug 8 18:14:36 2019
@@ -2475,6 +2475,10 @@ readAddressAreas(DWARFContext &dwarf, In
uint32_t cuIdx = 0;
for (std::unique_ptr<DWARFUnit> &cu : dwarf.compile_units()) {
+ if (Error e = cu->tryExtractDIEsIfNeeded(false)) {
+ error(toString(sec) + ": " + toString(std::move(e)));
+ return {};
+ }
Expected<DWARFAddressRangesVector> ranges = cu->collectAddressRanges();
if (!ranges) {
error(toString(sec) + ": " + toString(ranges.takeError()));
Modified: lld/trunk/test/ELF/gdb-index-parse-fail.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gdb-index-parse-fail.s?rev=368378&r1=368377&r2=368378&view=diff
==============================================================================
--- lld/trunk/test/ELF/gdb-index-parse-fail.s (original)
+++ lld/trunk/test/ELF/gdb-index-parse-fail.s Thu Aug 8 18:14:36 2019
@@ -1,10 +1,8 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
-# RUN: ld.lld --gdb-index %t1.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld --gdb-index %t1.o -o %t 2>&1 | FileCheck %s
-# FIXME: ld.lld should return non-zero (add a "NOT" to start once this bug is fixed)
-
-# CHECK: error: invalid contribution to string offsets table
+# CHECK: error: {{.*}}:(.debug_info): invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
.section .debug_abbrev,"", at progbits
.byte 1 # Abbreviation Code
More information about the llvm-commits
mailing list