[PATCH] D32722: Verify that all references point to actual DIEs in "llvm-dwarfdump --verify"

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 16:16:52 PDT 2017


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.

> On May 1, 2017, at 4:14 PM, Greg Clayton <clayborg at gmail.com> wrote:
> 
> 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.
> 
> Greg
>> On May 1, 2017, at 4:11 PM, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote:
>> 
>> 
>> 
>> On Mon, May 1, 2017 at 4:07 PM Greg Clayton via Phabricator <reviews at reviews.llvm.org <mailto:reviews at reviews.llvm.org>> wrote:
>> clayborg created this revision.
>> Herald added a subscriber: mehdi_amini.
>> 
>> 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.
>> 
>> This seems strictly stronger than the bounds check. Is it worth having the bounds check if we have this stronger check?
>>  
>> 
>> 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.
>> 
>> 
>> https://reviews.llvm.org/D32722 <https://reviews.llvm.org/D32722>
>> 
>> Files:
>>   include/llvm/DebugInfo/DWARF/DWARFContext.h
>>   include/llvm/DebugInfo/DWARF/DWARFUnit.h
>>   lib/DebugInfo/DWARF/DWARFContext.cpp
>>   unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170501/30bb1a42/attachment.html>


More information about the llvm-commits mailing list