This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Allow aliases to aliases of raw input commands
ClosedPublic

Authored by kastiglione on Jan 13 2022, 4:10 PM.

Details

Summary

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.

Diff Detail

Event Timeline

kastiglione created this revision.Jan 13 2022, 4:10 PM
kastiglione requested review of this revision.Jan 13 2022, 4:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2022, 4:10 PM
jingham requested changes to this revision.Jan 13 2022, 7:39 PM

Should this have a test?

This revision now requires changes to proceed.Jan 13 2022, 7:39 PM
kastiglione retitled this revision from [lldb] Allow aliases to aliases to command-regex to [lldb] Allow aliases to aliases of raw input commands.Jan 21 2022, 4:25 PM
kastiglione edited the summary of this revision. (Show Details)

That tests that we made the alias, but not that it actually works. If you did something like:

command alias start_with_two expr -- 2
command alias add_two start_with_two +

then

add_two 3

should produce 5, which would be easy to test for.

kastiglione edited the summary of this revision. (Show Details)

use Jim's testing improvement

jingham accepted this revision.Jan 21 2022, 5:49 PM

What an excellent test!

LGTM

This revision is now accepted and ready to land.Jan 21 2022, 5:49 PM
This revision was automatically updated to reflect the committed changes.