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 @@ -206,6 +206,7 @@ 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 @@ ++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 @@ {"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 --- a/lldb/test/API/commands/statistics/basic/TestStats.py +++ b/lldb/test/API/commands/statistics/basic/TestStats.py @@ -578,13 +578,18 @@ (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 @@ 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)