This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Redefining built-in commands.
- From: Don Howard <dhoward at redhat dot com>
- To: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Cc: <gdb at sources dot redhat dot com>
- Date: Wed, 5 Jun 2002 14:39:44 -0700 (PDT)
- Subject: Re: Redefining built-in commands.
On Fri, 31 May 2002, Eli Zaretskii wrote:
> > Date: Thu, 30 May 2002 17:24:05 -0700 (PDT)
> > From: Don Howard <dhoward@redhat.com>
> >
> > Should gdb allow users to redefine built-in commands?
>
> I think it should, unless we cannot do it safely.
>
> > If so, should the
> > orignial alias continue to behave like the original built-in, or should
> > it's behavior be modified also?
>
> I'm not 100% sure, but I tend to think the aliases that are mere
> abbreviations, like `n' for `next', should be redefined to the new
> command, while aliases which aren't abbreviations should be left to
> point to the original command.
>
> But if the above cannot be done, we should either redefine the aliases
> to the new command, or disable the aliases entirely. Crashing is not
> an option, obviously.
>
Ignoring the alias issue, I don't see any benefit to being able to
redefine built-in commands.
When a built-in command is redefined, it's original functionality is lost
for the remainder of that debugging session. For example, say the user
redefines the 'step' command -- there is no longer a way to do
source-level stepping.
(gdb) define step
> do something special
> step
> end
(gdb)
The above example ends up "doing something special" until gdb hits it's
recursion limit, rather than doing something special and then stepping.
The example *does* work just fine if the user picks anything other than a
built-in name:
(gdb) define special_step
> do something special
> step
> end
(gdb)
I think the ability to redefine built-in commands is a misfeature.
Users can always choose an alternate name for their custom commands.
--
dhoward@redhat.com
gdb engineering