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

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 05:15:45 PDT 2020


Orlando updated this revision to Diff 285627.
Orlando marked 2 inline comments as done.
Orlando edited the summary of this revision.
Orlando added a comment.

Thanks @aprantl and @jhenderson.

I'd be happy to write a yaml2obj test. The situation that I want to represent is this (note the var location range and the lexical block high_pc and low_pc):

  DW_TAG_compile_unit
    DW_AT_producer    ("clang version 11.0.0")
    DW_AT_language    (DW_LANG_C99)
    DW_AT_name        ("example.c")
    DW_AT_low_pc      (0x0000000000000000)
    DW_AT_high_pc     (0x000000000000000b)
  
    DW_TAG_subprogram
      DW_AT_low_pc    (0x0000000000000000)
      DW_AT_high_pc   (0x000000000000000b)
      DW_AT_name      ("fun")
      DW_AT_type      (0x00000061 "int")
  
      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)
          DW_AT_name  ("local")
          DW_AT_type  (0x00000061 "int")
  
        NULL
  
      NULL
  
    DW_TAG_base_type
      DW_AT_name      ("int")
      DW_AT_encoding  (DW_ATE_signed)
      DW_AT_byte_size (0x04)
  
    NULL

@jhenderson or @Higuoxing, is that something we're able to do with yaml2obj at the moment? Round-tripping my built test file through obj2yaml and yaml2obj (tools built at f5a252ed681 <https://reviews.llvm.org/rGf5a252ed681c155b1d6337309519ab27d5f3b450>) and using llvm-objdump shows:

  return.o:	file format elf64-x86-64
  
  .debug_info contents:

In the mean time I've shortened the assembly test and added a comment showing the llvm-dwarfdump output.

I've also changed the new stat name back to 'sum_all_variables(#bytes in any scope covered by DW_AT_location)'. I changed this in the last update to look more like 'sum_all_variables(#bytes in parent scope)', but I misunderstood the meaning of that stat. The most similar stat is "sum_all_variables(#bytes in any scope covered by DW_AT_location)". The name isn't great because both the new stat and this one both include DW_AT_const_value locations AFAICT. I think "sum_all_variables(#bytes in any scope covered by a location description) might be better, but I wanted to keep it in line with the existing stats.


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

https://reviews.llvm.org/D85636

Files:
  llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
  llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
  llvm/test/tools/llvm-dwarfdump/X86/statistics.ll
  llvm/test/tools/llvm-dwarfdump/X86/stats-scope-bytes-covered.s
  llvm/tools/llvm-dwarfdump/Statistics.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85636.285627.patch
Type: text/x-patch
Size: 18405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200814/ef0d6af3/attachment.bin>


More information about the llvm-commits mailing list