Skip to content

[lldb] Move some less-used log messages into the verbose types log #9731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,10 @@ bool SwiftLanguageRuntimeImpl::AddModuleToReflectionContext(
return false;
}
bool found = HasReflectionInfo(obj_file);
LLDB_LOG(GetLog(LLDBLog::Types), "{0} reflection metadata in \"{1}\"",
found ? "Adding" : "No",
module_sp->GetObjectName() ? module_sp->GetObjectName()
: obj_file->GetFileSpec().GetFilename());
LLDB_LOGV(GetLog(LLDBLog::Types), "{0} reflection metadata in \"{1}\"",
found ? "Adding" : "No",
module_sp->GetObjectName() ? module_sp->GetObjectName()
: obj_file->GetFileSpec().GetFilename());
if (!found)
return true;

Expand Down
12 changes: 6 additions & 6 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3108,9 +3108,9 @@ SwiftASTContext::CreateInstance(const SymbolContext &sc,
swift_ast_sp->RegisterSectionModules(*cur_module_sp, module_names);
if (GetLog(LLDBLog::Types)) {
std::string spacer(indent, '-');
LOG_PRINTF(GetLog(LLDBLog::Types), "+%s Dependency scan: %s",
spacer.c_str(),
cur_module_sp->GetSpecificationDescription().c_str());
LOG_VERBOSE_PRINTF(
GetLog(LLDBLog::Types), "+%s Dependency scan: %s", spacer.c_str(),
cur_module_sp->GetSpecificationDescription().c_str());
}
if (auto object = cur_module_sp->GetObjectFile()) {
FileSpecList file_list;
Expand All @@ -3124,9 +3124,9 @@ SwiftASTContext::CreateInstance(const SymbolContext &sc,
} else {
if (GetLog(LLDBLog::Types)) {
std::string spacer(indent, '-');
LOG_PRINTF(GetLog(LLDBLog::Types),
"+%s Could not find %s in images", spacer.c_str(),
fs.GetPath().c_str());
LOG_VERBOSE_PRINTF(GetLog(LLDBLog::Types),
"+%s Could not find %s in images",
spacer.c_str(), fs.GetPath().c_str());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def test(self):
"""Test that reflection metadata is imported"""
self.build()

log = self.getBuildArtifact("types.log")
self.runCmd('log enable lldb types -f "%s"' % log)
types_log = self.getBuildArtifact("types.log")
self.runCmd('log enable lldb types -v -f "%s"' % types_log)

target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
self, 'Set breakpoint here', lldb.SBFileSpec('main.swift'),
Expand All @@ -26,14 +26,6 @@ def test(self):
lldbutil.check_variable(self, var_c_x, value="23")

# Scan through the types log.
import io
logfile = io.open(log, "r", encoding='utf-8')
found_exe = 0
found_lib = 0
for line in logfile:
if re.search(r'Adding reflection metadata in .*a\.out', line):
found_exe += 1
if re.search(r'Adding reflection metadata in .*dynamic_lib', line):
found_lib += 1
self.assertEqual(found_exe, 1)
self.assertEqual(found_lib, 1)
self.filecheck('platform shell cat "%s"' % types_log, __file__)
# CHECK: {{Adding reflection metadata in .*a\.out}}
# CHECK: {{Adding reflection metadata in .*dynamic_lib}}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test(self):
self, 'Set breakpoint here', lldb.SBFileSpec('main.swift'),
extra_images=['dynamic_lib'])
log = self.getBuildArtifact('types.log')
self.expect('log enable lldb types -f ' + log)
self.expect('log enable lldb types -v -f ' + log)

check_var = lldbutil.check_variable
frame = thread.frames[0]
Expand Down