This is a primarily a refactor of the routines that are used to find individual range lists based on offsets or indices found as values of the DW_AT_ranges attribute.
Particularly DWARFUnit::findRnglistFromOffset() and DWARFUnit::findRnglistFromIndex() now return an Expected<> instead of a plain DWARFAddressRangesVector. This allows propagation of errors that occur during handling of the attribute, in particular invalid offsets and indices that are values of the DW_AT_ranges attribute. We did not report errors for this prior to this change.
As a result, a few routines that use the 2 mentioned above also return an Expected<>, which in turn means that their callers have to handle an error in some way if it occurs, e.g. DWARFDie::getAddressRanges() returns an Expected<> which means that their callers have to report the error, or ignore them.
This patch reports the error in the following contexts:
dumpAttribute() in DWARFDie.cpp DWARFDie::collectAddressRanges()
In the following contexts it's ignored (for now):
DWARFDie::collectChildrenAddressRanges() DWARFUnit::updateAddressDieMap() DWARFVerifier::verifyDieRanges() getLowPC() in llvm-dwarfdump/Statistics.cpp DWARFDie::addressRangeContainsAddress()
In these contexts I added FIXME comments, because we want to eventually report the error, but they either require support for .debug_aranges or more complex tests with child DIEs. I'd like to add them in a follow-on patch.
In the case of the verifier, it needs to handle DWARF v5 rnglists before we can report errors meaningfully.
The extraction of v4 range lists (DebugRangeLists.extract()) now also returns an Error instead of a boolean, which is reported in DWARFContext::dump().