Commit b9515041 authored by Dave Lee's avatar Dave Lee
Browse files

[lldb] Allow aliases to aliases of raw input commands

Allow users to create aliases for aliases to raw input commands. That probably
sounds convoluted, so here's an example:

command alias some-setup env SOMEVAR=SOMEVALUE

This an alias based on `env`, which itself is an alias for `_regex-env`.
`_regex-env` is a `command regex` command, which takes raw input.

The above `some-setup` alias fails with:

error: Unable to create requested alias.

This change allows such aliases to be created. lldb already supports aliases to
aliases for parsed commands.

Differential Revision:
parent 3726626a
......@@ -485,8 +485,9 @@ protected:
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)) {
......@@ -46,6 +46,8 @@ class NestedAliasTestCase(TestBase):
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 add_two', check=False)
self.runCmd('command unalias two', check=False)
# Execute the cleanup function during test case tear down.
......@@ -96,3 +98,8 @@ class NestedAliasTestCase(TestBase):
'Show variables for the current',
'stack frame.'],
# Check that aliases can be created for raw input commands.
self.expect('command alias two expr -- 2')
self.expect('command alias add_two two +')
self.expect('add_two 3', patterns=[' = 5$'])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment