From 760298adc264f9c1029d93ab38711c131e19a2f4 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 23 May 2022 11:00:22 -0700 Subject: [PATCH] [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 --- lldb/source/Commands/CommandObjectTarget.cpp | 7 +++++-- lldb/test/API/commands/help/TestHelp.py | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index f42588b..7789698 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -50,6 +50,7 @@ #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/Timer.h" +#include "lldb/lldb-enumerations.h" #include "lldb/lldb-private-enumerations.h" #include "llvm/ADT/ScopeExit.h" @@ -2901,8 +2902,10 @@ public: CommandObjectTargetModulesList(CommandInterpreter &interpreter) : CommandObjectParsed( interpreter, "target modules list", - "List current executable and dependent shared library images.", - "target modules list []") {} + "List current executable and dependent shared library images.") { + CommandArgumentData module_arg{eArgTypeShlibName, eArgRepeatStar}; + m_arguments.push_back({module_arg}); + } ~CommandObjectTargetModulesList() override = default; diff --git a/lldb/test/API/commands/help/TestHelp.py b/lldb/test/API/commands/help/TestHelp.py index e3363e8..09e7a32 100644 --- a/lldb/test/API/commands/help/TestHelp.py +++ b/lldb/test/API/commands/help/TestHelp.py @@ -105,6 +105,13 @@ class HelpCommandTestCase(TestBase): 'Dump the line table for one or more compilation units']) @no_debug_info_test + def test_help_image_list_shows_positional_args(self): + """Command 'help image list' should describe positional args.""" + # 'image' is an alias for 'target modules'. + self.expect("help image list", substrs=[ + ' [...]']) + + @no_debug_info_test def test_help_target_variable_syntax(self): """Command 'help target variable' should display ...""" self.expect("help target variable", -- 2.7.4