This is the mail archive of the
mailing list for the GDB project.
Re: Strangeness in set command
On Sat, 2008-04-05 at 14:54 -0400, Daniel Jacobowitz wrote:
> On Sat, Apr 05, 2008 at 08:12:43PM +0300, Eli Zaretskii wrote:
> > Does anyone object to improving the error message to mention "set
> > variable"?
> I don't think it will help; it's just luck you got an ambiguity since
> there are two commands starting with s. You could get any number of
> other errors, or even silent success. Like:
> (gdb) set ser.a = 1
> Undefined set serial command: ".a = 1". Try "help set serial".
> (gdb) set args.a = 1
> (gdb) show args
> Argument list to give program being debugged when it is started is ".a = 1".
I think the way to think about this is that the real
command is "set variable", and that "set " has been
allowed as a shortcut command so long as the argument
is not ambiguous with another "set" command.
The problem is that "so long as it is not ambiguous"
is dicy, and changes over time as we add new subcommands
The shortcut is probably one of those "seemed like a
good idea at the time" things, but now it's established
and we're stuck with it.
It would probably be a good idea if, every time we parse
a "set" command, we try to match it with BOTH a variable
AND a subcommand, and if there is ambiguity we say so