[PATCH] D38719: [llvm-dwarfdump] Verify compatible TAG for attributes.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 12 19:42:33 PDT 2021


On Wed, Oct 11, 2017 at 10:03 AM Adrian Prantl <aprantl at apple.com> wrote:

>
>
> > On Oct 11, 2017, at 9:45 AM, David Blaikie <dblaikie at gmail.com> wrote:
> >
> > Adrian - could you take a look here & see why
> DWARFVerifier::handleDebugInfo is creating empty TUSection/CUSection,
> rather than passing the DCtx's populated sections in? (that's my rough
> reading of the code, at least)
>
> It looks like this was introduced by https://reviews.llvm.org/D35521
>
> "This patch modifies the handleDebugInfo() function so that we verify the
> contents of each unit
> in the .debug_info section only if its header has been successfully
> verified."
>
> So it looks like the code is trying to avoid parsing the unit if the
> header didn't verify? At the first glance this does look bit redundant to
> me but I didn't give it a thorough reading.
>
> Jonas, can you make sense of it in the context of that commit? I would not
> be surprised if this is just compensating for a missing feature in the
> codebase at that point in time.
>
> If we can get away with deleting the redundant code that would definitely
> be a win.
>

Resurrecting this thread, since I just came across this issue again - while
trying to improve the verifier (after seeing a lot of "error: invalid DIE
reference 0x0000015f. Offset is in between DIEs:" followed by  a series of
blank lines - caused by
ReferenceToDIEOffsets being kept and used over multiple sections (when it
contains section relative offsets without any base section to know which
section they are relative to) - so you get invalid references from type
units, and then verifyDebugInfoReferences tries to dump the DIEs in the
type units that have the "invalid" references and it can't dump those DIEs
(just ends up with spooky blank lines) because it's looking in the wrong
section for them).

It seems this code introduced in D35521 is really likely to cause ongoing
headaches - by creating units that aren't in the DWARFContext's unit lists
that's going to be a problem for many uses of the libDebugInfoDWARF APIs
(like the one discussed in this review for navigating DIE to DIE references
- and I want to add a bunch more of those for reconstructing template names
(well, at the moment I have them in patches to the verifier, but they'll
probably more into libDebugInfoDWARF's normal APIs and be used by the
verifier - but that'll have the same problem)).

Any chance of this getting fixed? Perhaps we need a DWARFContext mode that
reflects the verifiers needs, while still preserving the usual DWARFContext
invariants of having the DWARFUnits in the DWARFContext's data structures,
rather than separately instantiated? (eg: a mode that includes invalid
headers in the list - so that the verifier can walk them and visit invalid
headers?)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210812/3630d95f/attachment.html>


More information about the llvm-commits mailing list