[llvm] [DebugInfo] Separate error generation from reporting in DWARFHeaderUnit::extract (PR #68242)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 13 15:32:51 PDT 2023
================
@@ -89,9 +89,12 @@ void fixupIndexV4(DWARFContext &C, DWARFUnitIndex &Index) {
DWARFDataExtractor Data(DObj, S, C.isLittleEndian(), 0);
while (Data.isValidOffset(Offset)) {
DWARFUnitHeader Header;
- if (!Header.extract(C, Data, &Offset, DWARFSectionKind::DW_SECT_INFO)) {
+ if (Error ExtractionErr = Header.extract(
+ C, Data, &Offset, DWARFSectionKind::DW_SECT_INFO)) {
logAllUnhandledErrors(
- createError("Failed to parse CU header in DWP file"), errs());
+ joinErrors(createError("Failed to parse CU header in DWP file"),
+ std::move(ExtractionErr)),
+ errs());
----------------
dwblaikie wrote:
ah, `fixupIndex` should be reachable (simplest way to find it would be to `assert(false);` in there and you'd find which tests reach the code) via tests using `-manaully-generate-unit-index` - though they might not be testing invalid headers, and such - and could be improved to do so, that'd involve some manually crafted DWARF (probably written in assembly and assembled with `llvm-mc` in the test) that has a corrupted header.
It's a bit of a chore to create a hand-crafted dwp file, though...
https://github.com/llvm/llvm-project/pull/68242
More information about the llvm-commits
mailing list