Skip to content

Change image list -r so that it actually shows the ref count and whether the image is in the shared cache. #83341

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 1 commit into from
Feb 29, 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
8 changes: 6 additions & 2 deletions lldb/source/Commands/CommandObjectTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3376,15 +3376,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
4 changes: 2 additions & 2 deletions lldb/source/Commands/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,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