mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
[DWARF parser] Make DWARF parser more robust against missing compile/type units.
DWARF standard claims that each compilation/type unit header in .debug_info/.debug_types section must be followed by corresponding compile/type unit DIE, possibly with its children. Two situations are possible: * compile/type unit DIE is missing because DWARF producer failed to emit it. * DWARF parser failed to parse unit DIE correctly, for instance if it contains some unsupported attributes (see r237721, for instance). In either of these cases, the library, and the tools that use it (llvm-dwarfdump, llvm-symbolizer) should not crash. Insert appropriate checks to protect against this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237733 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -310,8 +310,11 @@ void DWARFUnit::clearDIEs(bool KeepCUDie) {
|
||||
}
|
||||
|
||||
void DWARFUnit::collectAddressRanges(DWARFAddressRangesVector &CURanges) {
|
||||
// First, check if CU DIE describes address ranges for the unit.
|
||||
const auto &CUDIERanges = getCompileUnitDIE()->getAddressRanges(this);
|
||||
const auto *U = getUnitDIE();
|
||||
if (U == nullptr)
|
||||
return;
|
||||
// First, check if unit DIE describes address ranges for the whole unit.
|
||||
const auto &CUDIERanges = U->getAddressRanges(this);
|
||||
if (!CUDIERanges.empty()) {
|
||||
CURanges.insert(CURanges.end(), CUDIERanges.begin(), CUDIERanges.end());
|
||||
return;
|
||||
|
Reference in New Issue
Block a user