[Lldb-commits] [PATCH] D138383: Add a new top level statistic that tracks how many modules have variable errors.

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 20 09:42:36 PST 2022


clayborg created this revision.
clayborg added reviewers: labath, JDevlieghere, GeorgeHuyubo, yinghuitan.
Herald added a project: All.
clayborg requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138383

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
@@ -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)
Index: lldb/source/Target/Statistics.cpp
===================================================================
--- lldb/source/Target/Statistics.cpp
+++ 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},
   };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138383.476756.patch
Type: text/x-patch
Size: 3336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221120/32e0b65f/attachment.bin>


More information about the lldb-commits mailing list