Skip to content

Commit 5e4dd88

Browse files
kastiglionejimingham
authored andcommitted
[lldb] Specify aguments of image list
Register positional argument details in `CommandObjectTargetModulesList`. I recently learned that `image list` takes a module name, but the help info does not indicate this. With this change, `help image list` will show that it accepts zero or more module names. This makes it easier to get info about specific modules, without having to find/grep through the full image list. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D125154 (cherry picked from commit 760298a)
1 parent c88eb22 commit 5e4dd88

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lldb/source/Commands/CommandObjectTarget.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include "lldb/Utility/LLDBLog.h"
5353
#include "lldb/Utility/State.h"
5454
#include "lldb/Utility/Timer.h"
55+
#include "lldb/lldb-enumerations.h"
5556
#include "lldb/lldb-private-enumerations.h"
5657

5758
#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
@@ -2945,8 +2946,10 @@ class CommandObjectTargetModulesList : public CommandObjectParsed {
29452946
CommandObjectTargetModulesList(CommandInterpreter &interpreter)
29462947
: CommandObjectParsed(
29472948
interpreter, "target modules list",
2948-
"List current executable and dependent shared library images.",
2949-
"target modules list [<cmd-options>]") {}
2949+
"List current executable and dependent shared library images.") {
2950+
CommandArgumentData module_arg{eArgTypeShlibName, eArgRepeatStar};
2951+
m_arguments.push_back({module_arg});
2952+
}
29502953

29512954
~CommandObjectTargetModulesList() override = default;
29522955

lldb/test/API/commands/help/TestHelp.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ def test_help_image_du_line_should_work(self):
103103
self.expect("help image du line", substrs=[
104104
'Dump the line table for one or more compilation units'])
105105

106+
@no_debug_info_test
107+
def test_help_image_list_shows_positional_args(self):
108+
"""Command 'help image list' should describe positional args."""
109+
# 'image' is an alias for 'target modules'.
110+
self.expect("help image list", substrs=[
111+
'<shlib-name> [...]'])
112+
106113
@no_debug_info_test
107114
def test_help_target_variable_syntax(self):
108115
"""Command 'help target variable' should display <variable-name> ..."""

0 commit comments

Comments
 (0)