<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">We also might want to eventually verify that something like a DW_AT_type points to something that is a valid type DIE, so I am guessing we can use this second check for more powerful verifications. If a DW_AT_type points to something valid, but say a "DW_TAG_compile_unit", we should make an error.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 1, 2017, at 4:14 PM, Greg Clayton <<a href="mailto:clayborg@gmail.com" class="">clayborg@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Yes because 99% of all references are CU relative and you don't want a CU relative link traversing over into another CU and still being valid by luck. It also identifies the reference as bad before we try to look it up.<div class=""><br class=""></div><div class="">Greg<br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 1, 2017, at 4:11 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" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, May 1, 2017 at 4:07 PM Greg Clayton via Phabricator <<a href="mailto:reviews@reviews.llvm.org" class="">reviews@reviews.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">clayborg created this revision.<br class="">
Herald added a subscriber: mehdi_amini.<br class="">
<br class="">
LTO and other fancy linking previously led to DWARF that contained invalid references. We already validate that CU relative references fall into the CU, and the DW_FORM_ref_addr references fall inside the .debug_info section, but we didn't validate that the references pointed to correct DIE offsets. This new verification will ensure that all references refer to actual DIEs and not an offset in between.<br class=""></blockquote><div class=""><br class="">This seems strictly stronger than the bounds check. Is it worth having the bounds check if we have this stronger check?<br class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="">
This caught a bug in DWARFUnit::getDIEForOffset() where if you gave it any offset, it would match the DIE that mathes the offset _or_ the next DIE. This has been fixed.<br class="">
<br class="">
<br class="">
<a href="https://reviews.llvm.org/D32722" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/D32722</a><br class="">
<br class="">
Files:<br class="">
  include/llvm/DebugInfo/DWARF/DWARFContext.h<br class="">
  include/llvm/DebugInfo/DWARF/DWARFUnit.h<br class="">
  lib/DebugInfo/DWARF/DWARFContext.cpp<br class="">
  unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br class="">
<br class="">
</blockquote></div></div>
</div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>