Skip to content

[lldb] Show module name in progress update for downloading symbols (#85342) #8414

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 2 commits into from
Mar 16, 2024
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
23 changes: 10 additions & 13 deletions lldb/source/Commands/CommandObjectTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3171,15 +3171,19 @@ class CommandObjectTargetModulesList : public CommandObjectParsed {

case 'r': {
size_t ref_count = 0;
char in_shared_cache = 'Y';

ModuleSP module_sp(module->shared_from_this());
if (!ModuleList::ModuleIsInCache(module))
in_shared_cache = 'N';
if (module_sp) {
// Take one away to make sure we don't count our local "module_sp"
ref_count = module_sp.use_count() - 1;
}
if (width)
strm.Printf("{%*" PRIu64 "}", width, (uint64_t)ref_count);
strm.Printf("{%c %*" PRIu64 "}", in_shared_cache, width, (uint64_t)ref_count);
else
strm.Printf("{%" PRIu64 "}", (uint64_t)ref_count);
strm.Printf("{%c %" PRIu64 "}", in_shared_cache, (uint64_t)ref_count);
} break;

case 's':
Expand Down Expand Up @@ -4319,11 +4323,8 @@ class CommandObjectTargetSymbolsAdd : public CommandObjectParsed {

ModuleSpec module_spec;
module_spec.GetUUID() = frame_module_sp->GetUUID();

if (FileSystem::Instance().Exists(frame_module_sp->GetPlatformFileSpec())) {
module_spec.GetArchitecture() = frame_module_sp->GetArchitecture();
module_spec.GetFileSpec() = frame_module_sp->GetPlatformFileSpec();
}
module_spec.GetArchitecture() = frame_module_sp->GetArchitecture();
module_spec.GetFileSpec() = frame_module_sp->GetPlatformFileSpec();

if (!DownloadObjectAndSymbolFile(module_spec, result, flush)) {
result.AppendError("unable to find debug symbols for the current frame");
Expand Down Expand Up @@ -4368,12 +4369,8 @@ class CommandObjectTargetSymbolsAdd : public CommandObjectParsed {

ModuleSpec module_spec;
module_spec.GetUUID() = frame_module_sp->GetUUID();

if (FileSystem::Instance().Exists(
frame_module_sp->GetPlatformFileSpec())) {
module_spec.GetArchitecture() = frame_module_sp->GetArchitecture();
module_spec.GetFileSpec() = frame_module_sp->GetPlatformFileSpec();
}
module_spec.GetFileSpec() = frame_module_sp->GetPlatformFileSpec();
module_spec.GetArchitecture() = frame_module_sp->GetArchitecture();

bool current_frame_flush = false;
if (DownloadObjectAndSymbolFile(module_spec, result, current_frame_flush))
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Commands/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,8 @@ let Command = "target modules list" in {
OptionalArg<"Width">, Desc<"Display the modification time with optional "
"width of the module.">;
def target_modules_list_ref_count : Option<"ref-count", "r">, Group<1>,
OptionalArg<"Width">, Desc<"Display the reference count if the module is "
"still in the shared module cache.">;
OptionalArg<"Width">, Desc<"Display whether the module is still in the "
"the shared module cache (Y/N), and its shared pointer use_count.">;
def target_modules_list_pointer : Option<"pointer", "p">, Group<1>,
OptionalArg<"None">, Desc<"Display the module pointer.">;
def target_modules_list_global : Option<"global", "g">, Group<1>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1066,11 +1066,21 @@ bool SymbolLocatorDebugSymbols::DownloadObjectAndSymbolFile(
command << lookup_arg;

// Log and report progress.
std::string lookup_desc;
if (uuid_ptr && file_spec_ptr)
lookup_desc =
llvm::formatv("{0} ({1})", file_spec_ptr->GetFilename().GetString(),
uuid_ptr->GetAsString());
else if (uuid_ptr)
lookup_desc = uuid_ptr->GetAsString();
else if (file_spec_ptr)
lookup_desc = file_spec_ptr->GetFilename().GetString();

Log *log = GetLog(LLDBLog::Host);
LLDB_LOG(log, "Calling {0} with {1} to find dSYM: {2}", dsymForUUID_exe_path,
lookup_arg, command.GetString());
LLDB_LOG(log, "Calling {0} for {1} to find dSYM: {2}", dsymForUUID_exe_path,
lookup_desc, command.GetString());

Progress progress("Downloading symbol file", lookup_arg);
Progress progress("Downloading symbol file for", lookup_desc);

// Invoke dsymForUUID.
int exit_status = -1;
Expand Down