[PATCH] D88048: [dwarfdump] Add verifier check to find DIEs with DW_CHILDREN_yes but without children.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 19:57:34 PDT 2020


Higuoxing added a comment.

In D88048#2286589 <https://reviews.llvm.org/D88048#2286589>, @dblaikie wrote:

> 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?)

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 <https://reviews.llvm.org/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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88048/new/

https://reviews.llvm.org/D88048



More information about the llvm-commits mailing list