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


On Thu, Sep 22, 2011 at 6:54 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Wednesday 21 September 2011 22:12:11, Doug Evans wrote:
>> + ? ? ?make_cleanup ((make_cleanup_ftype *) dyn_string_delete, from_prefix);
>> + ? ? ?to_prefix = dyn_string_new (10);
>> + ? ? ?make_cleanup ((make_cleanup_ftype *) dyn_string_delete, to_prefix);
>
> Please don't add more casts to make_cleanup_ftype.

/me wishes all existing uses got cleaned up - monkey see monkey do ...

> Any special reason `-f "maint bah foo" -t "info bar"' is forbidden?

Couldn't think of a use for it.
Support can be added later if/when warranted.

> I was thinking that we'd only verify whether "info" exists. ?But maybe
> that shouldn't either be verified. ?Having aliases not erroring out if the
> destination doesn't exist allows one putting aliases in .gdbinit
> without worrying if the gdb that'll load has FROM already (it may be
> too old, but not old enough to not support "alias").

I like being restrictive in error catching, at least in the early stages.

btw, if the gdb has python one could wrap it and catch alias failure.

Not that this helps people with older gdb's,
but maybe cli should have its own "try" command
(or we could just require python for such things).

> So this branch ...
>
>> + ?if (to_argv[1] == NULL)
>> + ? ?{
>> + ? ? ?/* add_cmd requires we allocate space for name, hence the xstrdup. ?*/
>> + ? ? ?add_com_alias (xstrdup (to_argv[0]), from, class_alias, abbrev_flag);
>> + ? ?}
>
> is silent if FROM does not exist, though the other branch errors out.
> Just pointing it out -- not sure it was on purpose.

Oversight, thanks.

Now I just need a doc RFA.


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