[Lldb-commits] [PATCH] D86662: Simplify Symbol Status Message to Only Debug Info Size

Yifan Shen via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 26 14:00:13 PDT 2020


aelitashen created this revision.
aelitashen added reviewers: wallace, clayborg.
Herald added subscribers: lldb-commits, aprantl.
Herald added a project: LLDB.
aelitashen requested review of this revision.
Herald added a subscriber: JDevlieghere.

The Symbol Status in modules view is simplified so that only when the module has debug info and its size is non-zero, will the status message be displayed. The symbol status message is renamed to debug info size and flag message like "Symbols not found" and "Symbols loaded" is deleted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86662

Files:
  lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
  lldb/tools/lldb-vscode/JSONUtils.cpp


Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===================================================================
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -354,7 +354,6 @@
 
 static std::string ConvertDebugInfoSizeToString(uint64_t debug_info) {
   std::ostringstream oss;
-  oss << " (";
   oss << std::fixed << std::setprecision(1);
 
   if (debug_info < 1024) {
@@ -370,7 +369,6 @@
     oss << gb << "GB";
     ;
   }
-  oss << ")";
   return oss.str();
 }
 llvm::json::Value CreateModule(lldb::SBModule &module) {
@@ -385,19 +383,16 @@
   std::string module_path(module_path_arr);
   object.try_emplace("path", module_path);
   if (module.GetNumCompileUnits() > 0) {
-    std::string symbol_str = "Symbols loaded.";
     uint64_t debug_info = GetDebugInfoSize(module);
     if (debug_info > 0) {
-      symbol_str += ConvertDebugInfoSizeToString(debug_info);
+      std::string debug_info_size = ConvertDebugInfoSizeToString(debug_info);
+      object.try_emplace("symbolStatus", debug_info_size);
     }
-    object.try_emplace("symbolStatus", symbol_str);
     char symbol_path_arr[PATH_MAX];
     module.GetSymbolFileSpec().GetPath(symbol_path_arr,
                                        sizeof(symbol_path_arr));
     std::string symbol_path(symbol_path_arr);
     object.try_emplace("symbolFilePath", symbol_path);
-  } else {
-    object.try_emplace("symbolStatus", "Symbols not found.");
   }
   std::string loaded_addr = std::to_string(
       module.GetObjectFileHeaderAddress().GetLoadAddress(g_vsc.target));
Index: lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
===================================================================
--- lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
+++ lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
@@ -32,26 +32,20 @@
         self.assertIn('path', program_module, 'make sure path is in module')
         self.assertEqual(program, program_module['path'])
         self.assertTrue('symbolFilePath' not in program_module, 'Make sure a.out.stripped has no debug info')
-        self.assertEqual('Symbols not found.', program_module['symbolStatus'])
+        # self.assertEqual('Symbols not found.', program_module['symbolStatus'])
         symbols_path = self.getBuildArtifact(symbol_basename)
         self.vscode.request_evaluate('`%s' % ('target symbols add -s "%s" "%s"' % (program, symbols_path)))
 
-        def checkSymbolsLoaded():
-            active_modules = self.vscode.get_active_modules()
-            program_module = active_modules[program_basename]
-            return 'Symbols loaded.' == program_module['symbolStatus']
-
         def checkSymbolsLoadedWithSize():
             active_modules = self.vscode.get_active_modules()
             program_module = active_modules[program_basename]
             symbolsStatus = program_module['symbolStatus']
-            symbol_regex = re.compile(r"Symbols loaded. \([0-9]+(\.[0-9]*)?[KMG]?B\)")
+            # symbol_regex = re.compile(r"Symbols loaded. \([0-9]+(\.[0-9]*)?[KMG]?B\)")
+            symbol_regex = re.compile(r"[0-9]+(\.[0-9]*)?[KMG]?B")
             return symbol_regex.match(program_module['symbolStatus'])
                 
         if expect_debug_info_size:
             self.waitUntil(checkSymbolsLoadedWithSize)
-        else:
-            self.waitUntil(checkSymbolsLoaded)
         active_modules = self.vscode.get_active_modules()
         program_module = active_modules[program_basename]
         self.assertEqual(program_basename, program_module['name'])


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86662.288110.patch
Type: text/x-patch
Size: 3573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200826/363f9e1a/attachment.bin>


More information about the lldb-commits mailing list