Author: Greg Clayton Date: 2022-11-20T12:34:16-08:00 New Revision: aac1c3b15aae7a13f6861c6a58729d68d2f1eab0
URL: https://github.com/llvm/llvm-project/commit/aac1c3b15aae7a13f6861c6a58729d68d2f1eab0 DIFF: https://github.com/llvm/llvm-project/commit/aac1c3b15aae7a13f6861c6a58729d68d2f1eab0.diff LOG: Add a new top level statistic that tracks how many modules have variable errors. We have a statistic on each module named "debugInfoHadVariableErrors" which tracks when we have debug info, but an error prevented the variables from being displayed. This patch adds a new top level statistic named "totalModuleCountWithVariableErrors" which is a count of the modules that have "debugInfoHadVariableErrors" set to true. Differential Revision: https://reviews.llvm.org/D138383 Added: Modified: lldb/source/Target/Statistics.cpp lldb/test/API/commands/statistics/basic/TestStats.py Removed: ################################################################################ diff --git a/lldb/source/Target/Statistics.cpp b/lldb/source/Target/Statistics.cpp index e0ac00e321fb9..e542f90c1b139 100644 --- a/lldb/source/Target/Statistics.cpp +++ b/lldb/source/Target/Statistics.cpp @@ -206,6 +206,7 @@ llvm::json::Value DebuggerStats::ReportStatistics(Debugger &debugger, const uint64_t num_modules = Module::GetNumberAllocatedModules(); uint32_t num_debug_info_enabled_modules = 0; uint32_t num_modules_has_debug_info = 0; + uint32_t num_modules_with_variable_errors = 0; uint32_t num_stripped_modules = 0; for (size_t image_idx = 0; image_idx < num_modules; ++image_idx) { Module *module = Module::GetAllocatedModuleAtIndex(image_idx); @@ -261,6 +262,8 @@ llvm::json::Value DebuggerStats::ReportStatistics(Debugger &debugger, ++num_debug_info_enabled_modules; if (module_stat.debug_info_size > 0) ++num_modules_has_debug_info; + if (module_stat.debug_info_had_variable_errors) + ++num_modules_with_variable_errors; } symtab_parse_time += module_stat.symtab_parse_time; symtab_index_time += module_stat.symtab_index_time; @@ -295,6 +298,7 @@ llvm::json::Value DebuggerStats::ReportStatistics(Debugger &debugger, {"totalDebugInfoByteSize", debug_info_size}, {"totalModuleCount", num_modules}, {"totalModuleCountHasDebugInfo", num_modules_has_debug_info}, + {"totalModuleCountWithVariableErrors", num_modules_with_variable_errors}, {"totalDebugInfoEnabled", num_debug_info_enabled_modules}, {"totalSymbolTableStripped", num_stripped_modules}, }; diff --git a/lldb/test/API/commands/statistics/basic/TestStats.py b/lldb/test/API/commands/statistics/basic/TestStats.py index 92c20162ed3d8..5a8aa9924c9f3 100644 --- a/lldb/test/API/commands/statistics/basic/TestStats.py +++ b/lldb/test/API/commands/statistics/basic/TestStats.py @@ -578,13 +578,18 @@ def test_had_frame_variable_errors(self): (target, process, thread, bkpt) = lldbutil.run_to_name_breakpoint(self, 'main') # Get stats and verify we had errors. - exe_stats = self.find_module_in_metrics(exe, self.get_stats()) + stats = self.get_stats() + exe_stats = self.find_module_in_metrics(exe, stats) self.assertTrue(exe_stats is not None) # Make sure we have "debugInfoHadVariableErrors" variable that is set to # false before failing to get local variables due to missing .o file. self.assertEqual(exe_stats['debugInfoHadVariableErrors'], False) + # Verify that the top level statistic that aggregates the number of + # modules with debugInfoHadVariableErrors is zero + self.assertEqual(stats['totalModuleCountWithVariableErrors'], 0) + # Try and fail to get variables vars = thread.GetFrameAtIndex(0).GetVariables(True, True, False, True) @@ -593,9 +598,14 @@ def test_had_frame_variable_errors(self): self.assertTrue(vars.GetError().Fail()) # Get stats and verify we had errors. - exe_stats = self.find_module_in_metrics(exe, self.get_stats()) + stats = self.get_stats() + exe_stats = self.find_module_in_metrics(exe, stats) self.assertTrue(exe_stats is not None) # Make sure we have "hadFrameVariableErrors" variable that is set to # true after failing to get local variables due to missing .o file. self.assertEqual(exe_stats['debugInfoHadVariableErrors'], True) + + # Verify that the top level statistic that aggregates the number of + # modules with debugInfoHadVariableErrors is greater than zero + self.assertGreater(stats['totalModuleCountWithVariableErrors'], 0) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits