[llvm] r333005 - [DebugInfo] Fix location list check in the verifier

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon May 28 23:20:14 PDT 2018


Yep, test case would be good here

On Tue, May 22, 2018 at 10:41 AM Jonas Devlieghere via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: jdevlieghere
> Date: Tue May 22 10:37:27 2018
> New Revision: 333005
>
> URL: http://llvm.org/viewvc/llvm-project?rev=333005&view=rev
> Log:
> [DebugInfo] Fix location list check in the verifier
>
> We weren't properly verifying location lists because we tried obtaining
> the offset as a constant.
>
> Modified:
>     llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=333005&r1=333004&r2=333005&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp Tue May 22 10:37:27
> 2018
> @@ -409,7 +409,7 @@ unsigned DWARFVerifier::verifyDebugInfoA
>      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::verifyDebugInfoA
>      };
>      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;
>    }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180528/164aaca6/attachment.html>


More information about the llvm-commits mailing list