[DebugInfo] Fix location list check in the verifier
We weren't properly verifying location lists because we tried obtaining the offset as a constant. llvm-svn: 333005
This commit is contained in:
parent
543c0e1d50
commit
7e0b023302
|
@ -409,7 +409,7 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die,
|
||||||
ReportError("DIE has invalid DW_AT_stmt_list encoding:");
|
ReportError("DIE has invalid DW_AT_stmt_list encoding:");
|
||||||
break;
|
break;
|
||||||
case DW_AT_location: {
|
case DW_AT_location: {
|
||||||
auto VerifyLocation = [&](StringRef D) {
|
auto VerifyLocationExpr = [&](StringRef D) {
|
||||||
DWARFUnit *U = Die.getDwarfUnit();
|
DWARFUnit *U = Die.getDwarfUnit();
|
||||||
DataExtractor Data(D, DCtx.isLittleEndian(), 0);
|
DataExtractor Data(D, DCtx.isLittleEndian(), 0);
|
||||||
DWARFExpression Expression(Data, U->getVersion(),
|
DWARFExpression Expression(Data, U->getVersion(),
|
||||||
|
@ -422,13 +422,13 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die,
|
||||||
};
|
};
|
||||||
if (Optional<ArrayRef<uint8_t>> Expr = AttrValue.Value.getAsBlock()) {
|
if (Optional<ArrayRef<uint8_t>> Expr = AttrValue.Value.getAsBlock()) {
|
||||||
// Verify inlined location.
|
// Verify inlined location.
|
||||||
VerifyLocation(llvm::toStringRef(*Expr));
|
VerifyLocationExpr(llvm::toStringRef(*Expr));
|
||||||
} else if (auto LocOffset = AttrValue.Value.getAsUnsignedConstant()) {
|
} else if (auto LocOffset = AttrValue.Value.getAsSectionOffset()) {
|
||||||
// Verify location list.
|
// Verify location list.
|
||||||
if (auto DebugLoc = DCtx.getDebugLoc())
|
if (auto DebugLoc = DCtx.getDebugLoc())
|
||||||
if (auto LocList = DebugLoc->getLocationListAtOffset(*LocOffset))
|
if (auto LocList = DebugLoc->getLocationListAtOffset(*LocOffset))
|
||||||
for (const auto &Entry : LocList->Entries)
|
for (const auto &Entry : LocList->Entries)
|
||||||
VerifyLocation({Entry.Loc.data(), Entry.Loc.size()});
|
VerifyLocationExpr({Entry.Loc.data(), Entry.Loc.size()});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue