<div dir="ltr"><div dir="ltr">On Wed, Oct 11, 2017 at 10:03 AM Adrian Prantl <<a href="mailto:aprantl@apple.com">aprantl@apple.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Oct 11, 2017, at 9:45 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
> <br>
> 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)<br>
<br>
It looks like this was introduced by <a href="https://reviews.llvm.org/D35521" rel="noreferrer" target="_blank">https://reviews.llvm.org/D35521</a><br>
<br>
"This patch modifies the handleDebugInfo() function so that we verify the contents of each unit<br>
in the .debug_info section only if its header has been successfully verified."<br>
<br>
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.<br>
<br>
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.<br>
<br>
If we can get away with deleting the redundant code that would definitely be a win.<br></blockquote><div><br>Resurrecting this thread, since I just came across this issue again - while trying to improve the verifier (after seeing a lot of "<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">error: invalid DIE reference 0x0000015f. Offset is in between DIEs:"</span> followed by  a series of blank lines - caused by <br>





<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">ReferenceToDIEOffsets</span> 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).<br><br>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)).<br><br>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?) </div></div></div>