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
This commit is contained in:
Yifan Shen 2020-09-01 15:59:51 -07:00 committed by Walter Erquinigo
parent 0224738c1a
commit 82139b8770
2 changed files with 5 additions and 15 deletions

View File

@ -32,26 +32,18 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
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'])

View File

@ -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));