[PATCH] D85636: [llvm-dwarfdump] Fix misleading scope byte coverage statistics

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 06:31:01 PDT 2020


Higuoxing added a comment.

Hi,

Currently, `obj2yaml` only supports dumping the `.debug_aranges` section. You might not be able to convert the object file to YAML. I'm very happy to handcraft one for you.

I stripped most of the unused attributes and DIEs. The following YAML can be accepted by `yaml2obj`. (`yaml2obj` doesn't support emitting the .debug_loc section, so we have to use raw content to generate it.)
Please let me know if it doesn't work.

It looks like:

  DW_TAG_compile_unit
    DW_AT_low_pc      (0x0000000000000000)
    DW_AT_high_pc     (0x000000000000000b)
  
    DW_TAG_subprogram
      DW_AT_low_pc    (0x0000000000000000)
      DW_AT_high_pc   (0x000000000000000b)
  
      DW_TAG_lexical_block
        DW_AT_low_pc  (0x0000000000000005)
        DW_AT_high_pc (0x000000000000000a)
  
        DW_TAG_variable
          DW_AT_location      (0x00000000: 
             [0x0000000000000000, 0x0000000000000005): DW_OP_reg5 RDI)
  
        NULL
  
      NULL
  
    NULL



  --- !ELF
  FileHeader:
    Class:   ELFCLASS64
    Data:    ELFDATA2LSB
    Type:    ET_EXEC
    Machine: EM_X86_64
  Sections:
    - Name:         .debug_loc
      Type:         SHT_PROGBITS
      AddressAlign: 0x01
      Content:      '0000000000000000050000000000000001005500000000000000000000000000000000'
  DWARF:
    debug_abbrev:
      - Code:     1
        Tag:      DW_TAG_compile_unit
        Children: DW_CHILDREN_yes
        Attributes:
          - Attribute: DW_AT_low_pc
            Form:      DW_FORM_addr
          - Attribute: DW_AT_high_pc
            Form:      DW_FORM_data4
      - Code:     2
        Tag:      DW_TAG_subprogram
        Children: DW_CHILDREN_yes
        Attributes:
          - Attribute: DW_AT_low_pc
            Form:      DW_FORM_addr
          - Attribute: DW_AT_high_pc
            Form:      DW_FORM_data4
      - Code:     3
        Tag:      DW_TAG_lexical_block
        Children: DW_CHILDREN_yes
        Attributes:
          - Attribute: DW_AT_low_pc
            Form:      DW_FORM_addr
          - Attribute: DW_AT_high_pc
            Form:      DW_FORM_data4
      - Code:     4
        Tag:      DW_TAG_variable
        Children: DW_CHILDREN_no
        Attributes:
          - Attribute: DW_AT_location
            Form:      DW_FORM_sec_offset
    debug_info:
      - Version:    4
        AbbrOffset: 0x00
        Entries:
          - AbbrCode: 1 ## DW_TAG_compile_unit
            Values:
              - Value: 0x00 ## DW_AT_low_pc
              - Value: 0x0b ## DW_AT_high_pc
          - AbbrCode: 2 ## DW_TAG_subprogram
            Values:
              - Value: 0x00 ## DW_AT_low_pc
              - Value: 0x0b ## DW_AT_high_pc
          - AbbrCode: 3 ## DW_TAG_lexical_block
            Values:
              - Value: 0x05 ## DW_AT_low_pc
              - Value: 0x05 ## DW_AT_high_pc
          - AbbrCode: 4 ## DW_TAG_variable
            Values:
              - Value: 0x00 ## DW_AT_sec_offset
          - AbbrCode: 0 ## NULL
          - AbbrCode: 0 ## NULL
          - AbbrCode: 0 ## NULL


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

https://reviews.llvm.org/D85636



More information about the llvm-commits mailing list