[PATCH] D66526: WIP: [utils] Add the llvm-locstats tool

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 05:28:46 PDT 2019


djtodoro created this revision.
djtodoro added reviewers: aprantl, vsk.
djtodoro added a project: debug-info.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
djtodoro added a parent revision: D66525: WIP: [llvm-dwarfdump] Add additional stats fields.

As we discussed on the D65585 <https://reviews.llvm.org/D65585>, this patch introduces the //llvm-locstats// tool.

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. There are options for considering only local variables or formal parameters, and also there is an option for reporting the stats by ignoring the debug entry values generated.

**Using the tool**

//llvm-locstats test.o//

  =================================================
            Debug Location Statistics
  =================================================
        cov%          samples       percentage(~)
  -------------------------------------------------
           0                 1              16%
       1..50                 0               0%
      51..99                 2              33%
         100                 3              50%
  =================================================
  -the number of debug variables processed: 6
  -total availability: 83%
  -PC ranges covered: 81%
  =================================================

Or,

//llvm-locstats -only-formal-parameters -ignore-debug-entry-values test.o//

  =================================================
             Debug Location Statistics
  =================================================
        cov%          samples       percentage(~)
  -------------------------------------------------
          0                 0               0%
      1..50                 1              50%
     51..99                 0               0%
        100                 1              50%
  =================================================
  -the number of debug variables processed: 2
  -total availability: 100%
  -PC ranges covered: 75%
  =================================================

*********

TODOs:

- Revisit the `CMakefiles` changes. For now, I created dependency between the //llvm-locstats// and the //llvm-dwarfdump// tools, but I am sure this is not the right way to build it (actually just copying the llvm-locstats tool into the build folder).
- Add some tests
- Document the usage


https://reviews.llvm.org/D66526

Files:
  llvm/CMakeLists.txt
  llvm/tools/llvm-dwarfdump/CMakeLists.txt
  llvm/utils/llvm-locstats/CMakeLists.txt
  llvm/utils/llvm-locstats/llvm-locstats.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66526.216377.patch
Type: text/x-patch
Size: 11025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190821/ff2941bf/attachment.bin>


More information about the llvm-commits mailing list