This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA, doc RFA] Add gdb.add_command_alias
On Tue, Sep 13, 2011 at 12:15 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> Hmm, what's the advantage of add_alias_cmd over add_com_alias
> (or vice versa)?
add_com_alias is just a wrapper on add_alias_cmd for a particular case.
[or did I misunderstand?]
>> but that will require a bit more syntax.
>> One would need to distinguish aliasing
>> "spe" --> "set print elements"
>> from
>> "set print foobars" --> "set print elements".
>
> Ah, right, yes, of course. ?That sounds useful. ?Irrespective
> of what we do know,
[s/know/now/ I presume]
> do you think it _shouldn't_ work?
Eh?
> Maybe it's useful.
I think so.
> E.g., `alias -f FROM -t TO' would work for me. ?E.g.,
>
> (gdb) alias -f "set print foobars" -t "set print elements"
>
> The command would fail if "set" or "set print" in FROM
> don't exist, or TO doesn't exist. ?But if that's hard,
> we can just not support it (yet at least), as long as
> we leave the door open in terms of syntax.
-f and -t seem inconsistent with the existing u/i.
I'm guessing they're there so people don't have to deal with
remembering FROM/TO ordering (a la bcopy vs memcpy, intel vs att,
etc.)
If there was a consensus on the order one could remove requiring -f/-t later.
I think I will punt on handling `alias -f "set foobars" -t "set print
elements"' for now.
[If it falls out, great, but I'm not going to worry about it.]
btw,
"!pwd" would work if find_command_name_length recognized it as a 1-char command.
But the range of acceptable command spellings still bugs me.
If TUI doesn't use +,<,> for more than single-character length commands,
I wouldn't mind at least restricting +,<,> for only single-character commands,
and then add '!' as a single char command (if only when they're the
first character).