Re: confusion in the `b' command

Eli Zaretskii
2002-04-22T20:13:41Z

> From: Tom Tromey <tromey@redhat.com>
> Date: 22 Apr 2002 13:43:10 -0600
>
> Now try to set a breakpoint like this:
>
> b 'x.main<TAB>
>
> gdb just beeps at me.

What version of GDB is that? Head? branch? released version?

> So close the quotes and press enter:
>
> (gdb) b 'x.main'
> the class x does not have any method named main
> Hint: try 'x.main'<TAB> or 'x.main'<ESC-?>
> (Note leading single quote.)
>
> Now try again:
>
> b 'x.main<TAB>
>
> I get:
>
> (gdb) b 'x.main(java.lang.String[])'
>
> I think this must be a bug. I expected:
>
> * First, that TAB would work correctly the first time.

This is probably another manifestation of a known problem with
completion: different types of objects (files, symbols, commands,
etc.) need different sets of delimiter characters to make completion
DTRT, but Readline doesn't give GDB a chance to set the delimiters
before the first completion attempt. Thus, GDB gets the user input
after breakup into words, but the notion of ``a word'' does not match
what it should be for the object on which GDB is completing.

We currently try to work around this nuisance, but there's no way to
do that for the first completion attempt on a given object type.z

What we need is a hook from Readline that would be called _before_
Readline breaks up input into ``words''.

> * Second, that b 'x.main' would work anyway, since it is unambiguous.

I'm not sure what you mean here. Do you mean that GDB shouldn't have
forced you to quote the string "x.main(java.lang.String[])"?