<div dir="ltr">Sounds a lot like the existing statistics support in llvm-dwarfdump. Might be worth comparing/contrasting the two to understand the purpose of this new thing? (and/or integrate the functionality you'd like into the existing llvm-dwarfdump statistics support)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 1, 2019 at 9:07 AM Djordje Todorovic via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">djtodoro created this revision.<br>
djtodoro added reviewers: aprantl, vsk.<br>
djtodoro added a project: debug-info.<br>
Herald added subscribers: llvm-commits, mgorny.<br>
Herald added a project: LLVM.<br>
<br>
As we discussed, I am sharing the patch that introduces the llvm-locstats tool.<br>
<br>
(I am copying the summary from the README from <a href="https://github.com/djolertrk/llvm-locstats" rel="noreferrer" target="_blank">https://github.com/djolertrk/llvm-locstats</a>).<br>
<br>
This tool calculates and reports verbose output for the debug location coverage of a binary.<br>
<br>
It is very similar to a tool (locstats) from the Elfutils package, but the tool is not being maintained and released for a long time.<br>
<br>
The llvm-locstats for each variable or formal parameter DIE computes what percentage from the code section bytes, where it is in scope, it has location description. There are options to ignore inlined instances or/and entry value locations. The line 0 shows the number (and the percentage) of DIEs with no location information, but the line 100 shows the number (and the percentage) of DIEs where there is location information in all code section bytes (where the variable or parameter is in the scope). The line 51..59 shows the number (and the percentage) of DIEs where the location information is in between 51 and 59 percentage of its scope covered.<br>
...<br>
**Using the tool**<br>
<br>
Running the tool on a simple test case:<br>
bin/llvm-locstats test<br>
<br>
  =================================================<br>
            Debug Location Statistics<br>
  =================================================<br>
    cov%          samples       percentage<br>
  -------------------------------------------------<br>
      0                1              25%<br>
      1..9             0               0%<br>
      11..19           0               0%<br>
      21..29           0               0%<br>
      31..39           0               0%<br>
      41..49           0               0%<br>
      51..59           0               0%<br>
      61..69           0               0%<br>
      71..79           0               0%<br>
      81..89           0               0%<br>
      91..99           0               0%<br>
      100              3              75%<br>
  =================================================<br>
    -the number of debug variables processed: 4<br>
    -the average coverage per var: ~ 75%<br>
  =================================================<br>
<br>
//Running the tool on the GDB 7.11 binary://<br>
bin/llvm-locstats gdb<br>
<br>
  =================================================<br>
            Debug Location Statistics<br>
  =================================================<br>
    cov%          samples       percentage<br>
  -------------------------------------------------<br>
      0             8495               8%<br>
      1..9          3037               3%<br>
      11..19        3015               3%<br>
      21..29        2769               2%<br>
      31..39        2802               2%<br>
      41..49        2766               2%<br>
      51..59        3141               3%<br>
      61..69        3173               3%<br>
      71..79        3923               3%<br>
      81..89        4948               5%<br>
      91..99        7354               7%<br>
      100          53433              54%<br>
  =================================================<br>
    -the number of debug variables processed: 98856<br>
    -the average coverage per var: ~ 76%<br>
  =================================================<br>
<br>
//Running the tool on the GDB 7.11 binary by ignoring debug entry values://<br>
bin/llvm-locstats --ignore-entry-values gdb<br>
<br>
  =================================================<br>
            Debug Location Statistics<br>
  =================================================<br>
    cov%          samples       percentage<br>
  -------------------------------------------------<br>
      0             8765               8%<br>
      1..9          3948               3%<br>
      11..19        4436               4%<br>
      21..29        4152               4%<br>
      31..39        4107               4%<br>
      41..49        3846               3%<br>
      51..59        4490               4%<br>
      61..69        4140               4%<br>
      71..79        4998               5%<br>
      81..89        7072               7%<br>
      91..99       15478              15%<br>
      100          33424              33%<br>
  =================================================<br>
    -the number of debug variables processed: 98856<br>
    -the average coverage per var: ~ 69%<br>
  =================================================<br>
<br>
<br>
<a href="https://reviews.llvm.org/D65585" rel="noreferrer" target="_blank">https://reviews.llvm.org/D65585</a><br>
<br>
Files:<br>
  llvm/tools/llvm-locstats/CMakeLists.txt<br>
  llvm/tools/llvm-locstats/LLVMBuild.txt<br>
  llvm/tools/llvm-locstats/llvm-locstats.cpp<br>
<br>
</blockquote></div>