[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
Thu Aug 27 14:14:16 PDT 2020


aelitashen updated this revision to Diff 288456.
aelitashen added a comment.

Keep symbol status till new version released, remove comments in tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86662/new/

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,9 +354,7 @@
 
 static std::string ConvertDebugInfoSizeToString(uint64_t debug_info) {
   std::ostringstream oss;
-  oss << " (";
   oss << std::fixed << std::setprecision(1);
-
   if (debug_info < 1024) {
     oss << debug_info << "B";
   } else if (debug_info < 1024 * 1024) {
@@ -368,9 +366,7 @@
   } else {
     double gb = double(debug_info) / (1024.0 * 1024.0 * 1024.0);
     oss << gb << "GB";
-    ;
   }
-  oss << ")";
   return oss.str();
 }
 llvm::json::Value CreateModule(lldb::SBModule &module) {
@@ -386,11 +382,13 @@
   object.try_emplace("path", module_path);
   if (module.GetNumCompileUnits() > 0) {
     std::string symbol_str = "Symbols loaded.";
+    std::string debug_info_size;
     uint64_t debug_info = GetDebugInfoSize(module);
     if (debug_info > 0) {
-      symbol_str += ConvertDebugInfoSizeToString(debug_info);
+      debug_info_size = ConvertDebugInfoSizeToString(debug_info);
     }
     object.try_emplace("symbolStatus", symbol_str);
+    object.try_emplace("debugInfoSize", debug_info_size);
     char symbol_path_arr[PATH_MAX];
     module.GetSymbolFileSpec().GetPath(symbol_path_arr,
                                        sizeof(symbol_path_arr));
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,18 @@
         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'])
         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\)")
+            symbolsStatus = program_module['debugInfoSize']
+            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.288456.patch
Type: text/x-patch
Size: 3287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200827/52450f46/attachment.bin>


More information about the lldb-commits mailing list