[Lldb-commits] [PATCH] D117259: [lldb] Allow aliases to aliases to command-regex

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 21 16:25:20 PST 2022


kastiglione updated this revision to Diff 402132.
kastiglione added a comment.

add a test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117259/new/

https://reviews.llvm.org/D117259

Files:
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/test/API/commands/command/nested_alias/TestNestedAlias.py


Index: lldb/test/API/commands/command/nested_alias/TestNestedAlias.py
===================================================================
--- lldb/test/API/commands/command/nested_alias/TestNestedAlias.py
+++ lldb/test/API/commands/command/nested_alias/TestNestedAlias.py
@@ -46,6 +46,8 @@
             self.runCmd('command unalias rd', check=False)
             self.runCmd('command unalias fo', check=False)
             self.runCmd('command unalias foself', check=False)
+            self.runCmd('command unalias ls', check=False)
+            self.runCmd('command unalias sh', check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
@@ -96,3 +98,7 @@
                 'Show variables for the current',
                 'stack frame.'],
             matching=True)
+
+        # Check that aliases can be created for raw input commands.
+        self.expect('command alias sh platform shell -h --')
+        self.expect('command alias ls sh ls')
Index: lldb/source/Commands/CommandObjectCommands.cpp
===================================================================
--- lldb/source/Commands/CommandObjectCommands.cpp
+++ lldb/source/Commands/CommandObjectCommands.cpp
@@ -485,8 +485,9 @@
     OptionArgVectorSP option_arg_vector_sp =
         OptionArgVectorSP(new OptionArgVector);
 
-    if (CommandObjectSP cmd_obj_sp =
-            m_interpreter.GetCommandSPExact(cmd_obj.GetCommandName())) {
+    const bool include_aliases = true;
+    if (CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact(
+            cmd_obj.GetCommandName(), include_aliases)) {
       if (m_interpreter.AliasExists(alias_command) ||
           m_interpreter.UserCommandExists(alias_command)) {
         result.AppendWarningWithFormat(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117259.402132.patch
Type: text/x-patch
Size: 1794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220122/93803cee/attachment.bin>


More information about the lldb-commits mailing list