[llvm] [DebugInfo] Report errors when DWARFUnitHeader::applyIndexEntry fails (PR #89156)
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 14:22:07 PDT 2024
================
@@ -334,21 +338,33 @@ Error DWARFUnitHeader::extract(DWARFContext &Context,
return Error::success();
}
-bool DWARFUnitHeader::applyIndexEntry(const DWARFUnitIndex::Entry *Entry) {
+Error DWARFUnitHeader::applyIndexEntry(const DWARFUnitIndex::Entry *Entry) {
assert(Entry);
assert(!IndexEntry);
IndexEntry = Entry;
if (AbbrOffset)
- return false;
+ return createStringError(errc::invalid_argument,
+ "DWARF package unit at offset 0x%8.8" PRIx64
+ " has a non-zero abbreviation offset",
+ Offset);
+
auto *UnitContrib = IndexEntry->getContribution();
if (!UnitContrib ||
UnitContrib->getLength() != (getLength() + getUnitLengthFieldByteSize()))
- return false;
+ return createStringError(errc::invalid_argument,
+ "DWARF package unit at offset 0x%8.8" PRIx64
+ " has an inconsistent index",
+ Offset);
----------------
JDevlieghere wrote:
Seems like this clause is covering two things that should be reported separately: the lack of a unit and the length of the contribution not matching the expected length. The latter could be part of the error message (e.g. expected x, actual y).
https://github.com/llvm/llvm-project/pull/89156
More information about the llvm-commits
mailing list