<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 10, 2017, at 8:17 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Oct 10, 2017 at 12:06 PM Jonas Devlieghere <<a href="mailto:jdevlieghere@apple.com" class="">jdevlieghere@apple.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word; line-break: after-white-space;" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Oct 10, 2017, at 6:24 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class="m_-8536887263197915193Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Oct 10, 2017 at 10:06 AM Jonas Devlieghere via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank" class="">reviews@reviews.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">JDevlieghere marked 2 inline comments as done.<br class="">JDevlieghere added inline comments.<br class=""><br class=""><br class="">================<br class="">Comment at: lib/DebugInfo/DWARF/DWARFVerifier.cpp:423<br class="">+    // Make sure specification and abstract origin have compatible tag.<br class="">+    if (auto Offset = AttrValue.Value.getAsReference()) {<br class="">+<br class="">----------------<br class="">dblaikie wrote:<br class="">> Can you use DWARFDie::getAttributeValueAsReferencedDie here, perhaps?<br class="">Unfortunately not, because this makes use of `getUnitForOffset` which in turn uses a list of units that isn't build when doing the verification.<br class=""></blockquote><div class=""><br class="">Not sure I understand - this code calls getDIEForOffset, which calls getUnitForOffset as well. So why would one path be usable and the other not?<br class=""></div></div></div></div></blockquote><div class=""><br class=""></div></div></div><div style="word-wrap: break-word; line-break: after-white-space;" class=""><div class=""><div class="">I would have to double check with the code in front of me, but it uses an upper_bound to find the right unit based on the offset, and this code path doesn’t populate that list. I noticed this earlier when I was trying to understand why the name of the subroutine is shown when dumping the debug info but not when running the verifier. I think this is the result of only considering one unit at a time when verifying, but I didn’t dig much deeper once I had found the explanation. </div></div></div></blockquote><div class=""><br class="">Yeah, I'm really not understanding the difference between these possible codepaths.<br class=""><br class="">The code in this review calls:<br class=""><br class="">  auto Offset = AttrValue.Value.getAsReference()<br class="">  DCtx.getDIEForOffset(*Offset)<br class="">  ->CUs.getUnitForOffset(*Offset)->getDIEForOffset(*Offset);<br class=""><br class="">the code in DWARFDie::getAttributeValueAsReferencedDie calls:<br class=""><br class="">  auto SpecRef = toReference(find(Attr));<br class="">  U->getUnitSection().getUnitForOffset(*SpecRef)->getDIEForOffset(*SpecRef);<br class=""><br class="">(where 'getUnitSection' returns DWARFUnitSectionBase, and 'CUs' is a DWARFUnitSectionBase (well, a class derived from it, DWARFUnitSection<DWARFCompileUnit>)<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>The difference is that DWARFVerifier::handleDebugInfo is using “dummy” objects for the DWARFUnitSection objects:</div><div><br class=""></div><div>DWARFUnitSection<DWARFTypeUnit> TUSection{};</div><div>DWARFUnitSection<DWARFCompileUnit> CUSection{};</div><div><br class=""></div><div>As a result the list with CUs is empty and U->getUnitSection().getUnitForOffset(*Offset) returns nothing while CUs.getUnitForOffset(*Offset) returns the correct unit. </div><div><br class=""></div><div>I want to emphasize that I’m not trying to defend the current approach. Could you have a quick look at DWARFVerifier::handleDebugInfo and help me understand if there’s a good reason for this or maybe it is something that just needs to be fixed. </div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div class=""><br class="">So I'm really having a hard time understanding why these codepaths would be different & it seems subtle/worth fixing if they are.<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>Definitely! I’m relatively new to the code base so it’s not always obvious when something is a bug or I just lack the necessary understanding. </div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word; line-break: after-white-space;" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Furthermore, this is (probably) slightly more efficient as we already have the attribute value and therefore do not need to do any indirections via the abbrev declaration.<br class=""><br class=""><br class=""><a href="https://reviews.llvm.org/D38719" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/D38719</a></blockquote></div></div></div></blockquote></div></div></blockquote></div></div></div></blockquote></div><br class=""></body></html>