[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
Thu Jan 13 16:10:09 PST 2022


kastiglione created this revision.
kastiglione added a reviewer: jingham.
Herald added a subscriber: jeroen.dobbelaere.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Allow users to create aliases which invoke aliases to command-regex. That
probably sounds convoluted, so here's an example:

  command alias some-setup env SOMEVAR=SOMEVALUE

This an alias that invokes `env`, which is an alias for `_regex-env`, and
`_regex-env` is a `command regex`.

The above command fails with:

  error: Unable to create requested alias.

This change allows such aliases to be created.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117259

Files:
  lldb/source/Commands/CommandObjectCommands.cpp


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.399823.patch
Type: text/x-patch
Size: 780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220114/483aba93/attachment-0001.bin>


More information about the lldb-commits mailing list