diff --git a/lldb/source/Target/Statistics.cpp b/lldb/source/Target/Statistics.cpp --- a/lldb/source/Target/Statistics.cpp +++ b/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", diff --git a/lldb/test/API/commands/statistics/basic/TestStats.py b/lldb/test/API/commands/statistics/basic/TestStats.py --- a/lldb/test/API/commands/statistics/basic/TestStats.py +++ b/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)