Flag DIEs that have DW_CHILDREN_yes set in their abbreviation but don't actually have any children.
rdar://59809554
Differential D88048
[dwarfdump] Add verifier check to find DIEs with DW_CHILDREN_yes but without children. JDevlieghere on Sep 21 2020, 2:41 PM. Authored by
Details Flag DIEs that have DW_CHILDREN_yes set in their abbreviation but don't actually have any children. rdar://59809554
Diff Detail
Event TimelineComment Actions does this classify as a warning? Is there a distinction between ill-formed DWARF and "this is valid, but unlikely to be great"? Comment Actions I was on the fence myself, I couldn't find anything conclusive in the standard. I've made it a warning. Comment Actions maybe slightly long test case - could do this with the CU DIE itself? (perhaps a case where hand-crafted/substantially hand-modified assembly is OK, because it can be made /so/ simple - or maybe yaml2obj dwarf support is adequate for this use case?) Comment Actions Hi, currently, obj2yaml doesn't work properly when dumping the .debug_abbrev/__debug_abbrev section. We might not be able to get the correct output when there are multiple DIEs in one abbrev table. D87179 has fixed it but hasn't been landed yet. I've created one test case for this patch. Hope it works :-) --- !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB Type: ET_EXEC DWARF: debug_abbrev: - Table: - Tag: DW_TAG_compile_unit Children: DW_CHILDREN_yes Attributes: - Attribute: DW_AT_low_pc Form: DW_FORM_data4 debug_info: - Version: 4 Entries: - AbbrCode: 1 Values: - Value: 0x1234 - AbbrCode: 0 ## Terminator for the current DIE. However, it seems that the assertion isValid() && "must check validity prior to calling" is triggered when the DIE isn't terminated. --- !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB Type: ET_EXEC DWARF: debug_abbrev: - Table: - Tag: DW_TAG_compile_unit Children: DW_CHILDREN_yes Attributes: - Attribute: DW_AT_low_pc Form: DW_FORM_data4 debug_info: - Version: 4 Entries: - AbbrCode: 1 Values: - Value: 0x1234 See my inline comments.
Comment Actions Warning seems fine to me since it's more an inefficient encoding (an empty list of children) than malformed. LGTM once everyone else is happy. Comment Actions (I forgot to submit the comment before landing this) Awesome, thanks a lot, that's a great test case! :-) |