[Lldb-commits] [lldb] 82139b8 - Simplify Symbol Status Message to Only Debug Info Size
Walter Erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 1 16:25:28 PDT 2020
Author: Yifan Shen
Date: 2020-09-01T16:25:20-07:00
New Revision: 82139b8770ee07f0b778be7af22c529098ef12ec
URL: https://github.com/llvm/llvm-project/commit/82139b8770ee07f0b778be7af22c529098ef12ec
DIFF: https://github.com/llvm/llvm-project/commit/82139b8770ee07f0b778be7af22c529098ef12ec.diff
LOG: Simplify Symbol Status Message to Only Debug Info Size
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.
Differential Revision: https://reviews.llvm.org/D86662
Added:
Modified:
lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
lldb/tools/lldb-vscode/JSONUtils.cpp
Removed:
################################################################################
diff --git a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
index a16430fccae1..db70e4a8124b 100644
--- a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
+++ b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
@@ -32,26 +32,18 @@ def run_test(self, symbol_basename, expect_debug_info_size):
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'])
diff --git a/lldb/tools/lldb-vscode/JSONUtils.cpp b/lldb/tools/lldb-vscode/JSONUtils.cpp
index f6cdcf5a46cf..36156ca2c42f 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.cpp
+++ b/lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -354,9 +354,7 @@ static uint64_t GetDebugInfoSize(lldb::SBModule module) {
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 @@ static std::string ConvertDebugInfoSizeToString(uint64_t debug_info) {
} 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 @@ llvm::json::Value CreateModule(lldb::SBModule &module) {
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));
More information about the lldb-commits
mailing list