[Lldb-commits] [PATCH] D45547: [Command] Implement `stats`

Davide Italiano via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 11 17:14:33 PDT 2018


davide created this revision.
davide added reviewers: jingham, friss, JDevlieghere, aprantl, labath, clayborg.

This allows us to collect useful metrics about lldb debugging sessions.

I thought that an example would be better than a thousand words:

  Process 19705 stopped
  * thread #1, queue = 'com.apple.main-thread', stop reason = step in
      frame #0: 0x0000000100000fb4 blah`main at blah.c:3
     1    int main(void) {
     2      int a = 6;
  -> 3      return 0;
     4    }
  (lldb) stats enable
  (lldb) frame var a
  (int) a = 6
  (lldb) expr a
  (int) $1 = 6
  (lldb) stats disable
  ### Start STATISTICS dump ###
  Number of expr evaluation successes : 1
  Number of expr evaluation failures : 0
  Number of frame var successes : 1
  Number of frame var failures : 0
  ### End STATISTICS dump ###

Future improvements might include:

1. Passing a file, or implementing categories. The way this patch has been implements is generic enough to allow this to be extended easily without breaking the grammar
2. Adding an SBAPI and Python API for use in scripts.

Thanks to Jim Ingham for discussing the design with me.


https://reviews.llvm.org/D45547

Files:
  lldb/include/lldb/Target/Target.h
  lldb/include/lldb/lldb-private-enumerations.h
  lldb/packages/Python/lldbsuite/test/functionalities/stats/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/stats/TestStats.py
  lldb/packages/Python/lldbsuite/test/functionalities/stats/main.c
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Commands/CommandObjectStats.cpp
  lldb/source/Commands/CommandObjectStats.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45547.142101.patch
Type: text/x-patch
Size: 11082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180412/ac1052d6/attachment.bin>


More information about the lldb-commits mailing list