diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-05-22 17:37:27 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-05-22 17:37:27 +0000 |
| commit | 7e0b02330223ad79eab7842d82c4043fdd2deeec (patch) | |
| tree | d108de867a07024e5e83620e60db965889ed7646 /llvm/lib/DebugInfo | |
| parent | 543c0e1d508807c6d0e82cca0748e6b8ccc66948 (diff) | |
| download | bcm5719-llvm-7e0b02330223ad79eab7842d82c4043fdd2deeec.tar.gz bcm5719-llvm-7e0b02330223ad79eab7842d82c4043fdd2deeec.zip | |
[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
Diffstat (limited to 'llvm/lib/DebugInfo')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 4f1095cc310..356b141f44f 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -409,7 +409,7 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die, ReportError("DIE has invalid DW_AT_stmt_list encoding:"); break; case DW_AT_location: { - auto VerifyLocation = [&](StringRef D) { + auto VerifyLocationExpr = [&](StringRef D) { DWARFUnit *U = Die.getDwarfUnit(); DataExtractor Data(D, DCtx.isLittleEndian(), 0); DWARFExpression Expression(Data, U->getVersion(), @@ -422,13 +422,13 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die, }; if (Optional<ArrayRef<uint8_t>> Expr = AttrValue.Value.getAsBlock()) { // Verify inlined location. - VerifyLocation(llvm::toStringRef(*Expr)); - } else if (auto LocOffset = AttrValue.Value.getAsUnsignedConstant()) { + VerifyLocationExpr(llvm::toStringRef(*Expr)); + } else if (auto LocOffset = AttrValue.Value.getAsSectionOffset()) { // Verify location list. if (auto DebugLoc = DCtx.getDebugLoc()) if (auto LocList = DebugLoc->getLocationListAtOffset(*LocOffset)) for (const auto &Entry : LocList->Entries) - VerifyLocation({Entry.Loc.data(), Entry.Loc.size()}); + VerifyLocationExpr({Entry.Loc.data(), Entry.Loc.size()}); } break; } |

