This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA, doc RFA] Add gdb.add_command_alias (now: alias foo = bar)


On Fri, Sep 23, 2011 at 3:25 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Thu, 22 Sep 2011 11:22:26 -0700
>> From: Doug Evans <dje@google.com>
>> Cc: pedro@codesourcery.com, gdb-patches@sourceware.org
>>
>> >> +The @samp{-f FROM} option specifies the name of an existing command
>> >> +that is being aliased.
>> >> +
>> >> +The @samp{-t TO} option specifies the name of the new alias.
>> >
>> > Btw, I'm not sure FROM and TO are a good idea; it's not like you are
>> > copying something. ?How about COMMAND and ALIAS instead?
>>
>> Ok, but then I have to wonder about -f and -t.
>> -c and -a? [setting aside -a collides with the current -a for abbreviation]
>>
>> But if you're happy with -f COMMAND -t ALIAS, great.
>
> I'm not happy about that, either, FWIW. ?Why not use the popular
> syntax used by other programs that offer aliases? ?E.g.,
>
> ?(gdb) alias ALIAS=COMMAND
>
> But that's just MO, FWIW. ?If everyone else is happy with these letter
> switches, I can live with that.
>
>> >> +Note that if you are defining an alias of a @samp{set} command,
>> >> +you also need to define the alias of the corresponding @samp{show}
>> >> +command, if desired.
>> >
>> >
>> > "Need" and "if desired" are in contradiction. ?Which is it?
>>
>> How about if I reword it to:
>>
>> Note that if you are defining an alias of a @samp{set} command,
>> and you want to have an alias for the corresponding @samp{show}
>> command, then you need to define the latter separately.
>
> Works for me, thanks.

I thought about it a bit, and "alias foo = bar" does have advantages.

I will check this in next week if there are no objections.

Thanks.

2011-09-28  Doug Evans  <dje@google.com>

        Add new "alias" command.
        * NEWS: Mention new command.
        * command.h (valid_user_defined_cmd_name_p): Declare.
        * defs.h (make_cleanup_dyn_string_delete): Declare.
        * utils.c: #include "dyn-string.h".
        (do_dyn_string_delete, make_cleanup_dyn_string_delete): New functions.
        * cli/cli-cmds.c: #include "dyn-string.h".
        (argv_to_dyn_string, valid_command_p, alias_command): New functions.
        (init_cli_cmds): Add new command.
        * cli/cli-decode.c (valid_user_defined_cmd_name_p): New function.

        doc/
        * gdb.texinfo (Extending GDB): Document alias command.

        testsuite/
        * gdb.base/alias.exp: Add tests for alias command.

Attachment: gdb-110928-alias-2.patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]