This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Improve completion of locations
- To: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Subject: Re: [RFA] Improve completion of locations
- From: Daniel Berlin <dan at www dot cgsoftware dot com>
- Date: Sun, 6 May 2001 12:38:00 -0400 (EDT)
- cc: <gdb-patches at sources dot redhat dot com>
On Sun, 6 May 2001, Eli Zaretskii wrote:
>
> On Sun, 6 May 2001, Daniel Berlin wrote:
>
> > I can make it fail miserably with a simple example (IE my first
> > try).
> >
> > Try the following:
> > #include <stdio.h>
> > class fred
> > {
> > public:
> > int bob();
> > };
> > int fred::bob()
> > {
> > return 5;
> > }
> > int main(void)
> > {
> > fred test;
> > test.bob();
> > }
>
> Thanks for the example.
>
> > Complete on 'fred
> > It'll list fred and fred::bob(void)
> >
> > Hit enter (you need to clear the completion status to make it redo the
> > list)
> >
> > Complete on 'fred:
> >
> > It'll list every symbol around (Or at least, 3792 of them, i would
> > imagine this is every single one, i never checked)
> >
> > Complete on 'fred::
> > It'll complete to fred::bob(void)
> >
> > The first is fine
> > The third is fine
> > The second is what your patch breaks right now.
>
> Well, I'd hardly call this ``fail miserably''. It is also simple to fix;
> I'll post a modified patch soon.
At 4am in the mroning, everything seems miserable.
:)
>
> > It'll also break completion without quotes when i get around to rewriting
> > those amazingly complex parsing routines.
>
> I'm sorry, I don't follow: which parsing routines did you refer to? Does
> the code I wrote use them?
decode_line_1, et all.
You are doing the same type of thing, trying to determine what the user
wrote.
>
> > Would anyone really object if i just started a flex based lexer to parse
> > the specs, to replace all this silly ad-hoc parsing.
>
> Note that Readline has its own ideas about breaking user input into
> ``words'', and it does that even before our completion functions are
> called. So, in contrast to our code which parses the full location spec,
> completion cannot be much smarter than it currently is, because Readline
> doesn't give us a chance to be smarter. Most of the time I debugged this
> code went into trying to get along with Readline's idiosyncrasies.
Yeah, I figured as much.
Still, wouldn't it be easier to just say something like:
if (filename_spec_p(userstring))
else if (symbol_location_spec_p(userstring))
etc
We have like the same type of parsing going on in quite a few places, and
it just all seems completley ad-hoc.
>
> Thanks again for the feedback.
>