[Lldb-commits] [PATCH] D113810: Add the stop count to "statistics dump" in each target's dictionary.

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 15 18:59:32 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdbd36e1e9f16: Add the stop count to "statistics dump" in each target's dictionary. (authored by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113810

Files:
  lldb/source/Target/Statistics.cpp
  lldb/test/API/commands/statistics/basic/TestStats.py


Index: lldb/test/API/commands/statistics/basic/TestStats.py
===================================================================
--- lldb/test/API/commands/statistics/basic/TestStats.py
+++ lldb/test/API/commands/statistics/basic/TestStats.py
@@ -118,6 +118,12 @@
         stats = self.get_target_stats(self.get_stats())
         self.verify_success_fail_count(stats, 'frameVariable', 1, 0)
 
+        # Test that "stopCount" is available when the process has run
+        self.assertEqual('stopCount' in stats, True,
+                         'ensure "stopCount" is in target JSON')
+        self.assertGreater(stats['stopCount'], 0,
+                           'make sure "stopCount" is greater than zero')
+
     def test_default_no_run(self):
         """Test "statistics dump" without running the target.
 
@@ -154,7 +160,7 @@
         target = self.createTestTarget()
         debug_stats = self.get_stats()
         debug_stat_keys = [
-            'modules', 
+            'modules',
             'targets',
             'totalSymbolTableParseTime',
             'totalSymbolTableIndexTime',
@@ -217,7 +223,7 @@
                                           lldb.SBFileSpec("main.c"))
         debug_stats = self.get_stats()
         debug_stat_keys = [
-            'modules', 
+            'modules',
             'targets',
             'totalSymbolTableParseTime',
             'totalSymbolTableIndexTime',
@@ -255,7 +261,7 @@
         target = self.createTestTarget(file_path=exe)
         debug_stats = self.get_stats()
         debug_stat_keys = [
-            'modules', 
+            'modules',
             'targets',
             'totalSymbolTableParseTime',
             'totalSymbolTableIndexTime',
@@ -315,7 +321,7 @@
                             "details": {...},
                             "id": 2,
                             "resolveTime": 4.3632581669999997
-                        }                        
+                        }
                     ]
                 }
             ],
@@ -333,7 +339,7 @@
         self.runCmd("b a_function")
         debug_stats = self.get_stats()
         debug_stat_keys = [
-            'modules', 
+            'modules',
             'targets',
             'totalSymbolTableParseTime',
             'totalSymbolTableIndexTime',
@@ -363,5 +369,5 @@
             'resolveTime'
         ]
         for breakpoint in breakpoints:
-            self.verify_keys(breakpoint, 'target_stats["breakpoints"]', 
+            self.verify_keys(breakpoint, 'target_stats["breakpoints"]',
                              bp_keys_exist, None)
Index: lldb/source/Target/Statistics.cpp
===================================================================
--- lldb/source/Target/Statistics.cpp
+++ lldb/source/Target/Statistics.cpp
@@ -103,6 +103,8 @@
     if (unix_signals_sp)
       target_metrics_json.try_emplace("signals",
                                       unix_signals_sp->GetHitCountStatistics());
+    uint32_t stop_id = process_sp->GetStopID();
+    target_metrics_json.try_emplace("stopCount", stop_id);
   }
   target_metrics_json.try_emplace("breakpoints", std::move(breakpoints_array));
   target_metrics_json.try_emplace("totalBreakpointResolveTime",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113810.387477.patch
Type: text/x-patch
Size: 3222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211116/e6d47baf/attachment-0001.bin>


More information about the lldb-commits mailing list