[PATCH 4/6] gdb: add match formatter mechanism for 'complete' command output

Andrew Burgess aburgess@redhat.com
Fri Apr 12 22:29:02 GMT 2024


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Andrew Burgess <aburgess@redhat.com>
>> Cc: gdb-patches@sourceware.org
>> Date: Fri, 12 Apr 2024 18:42:12 +0100
>> 
>> >   (gdb) file '/tmp/xx<TAB>
>> >    => (gdb) file '/tmp/xx/'
>> >   (gdb) file '/tmp/xx/'a<TAB>
>> >    => (gdb) file '/tmp/xx/abcd'
>> >
>> > That is, allow to type after the closing quote, and remove the closing
>> > quote before trying to complete.  This way, the user can use
>> > '/tmp/xx/' if that is what she needs, or continue typing and
>> > completing if not.
>> 
>> That does sound better.  I think there are still things that would need
>> figuring out.  For example, what if the user didn't do the second tab
>> completion, but just kept typing.
>> 
>>   (gdb) file '/tmp/xx<TAB>
>> 	=> (gdb) file '/tmp/xx/'
>>   (gdb) file '/tmp/xx/'abcd<ENTER>
>> 	=> ?? What would this do?
>> 
>> What if there really was a file /tmp/xx/'abcd ? What happens then?
>
> ENTER does the same as TAB, and then submits the result.  So GDB will
> see '/tmp/xx/abcd' in that case.

This all sounds great.  Do you know of any other readline based projects
that do completion like this?

My concern here is that, as I understand readline, this isn't going to
be easy to implement.  And even if we could (somehow) convince readline
to do this, it's going to result in a bunch of extra complexity compared
to just having readline do things the way it wants to.

And no, GDB doesn't have to use readline, but I'd rather not have to
throw out readline just so we can have working filename completion.

I'm not trying to be dismissive here.  This started as "Andrew's come up
with a design, he should have discussed it first."  And I'm trying to
work out if this is a serious, we should do it this other way.  Or if
this is just "See, there are other ways it could be done, you should
have discussed it first"?

To both of these my answer would be, I've not really invented anything
here, I've just connected up GDB with readline, and what we get is the
readline way of doing things.

Maybe then you know that readline can be made to do things differently
(hence me asking for examples).  Or maybe you're suggesting we should
forget readline and do things as you suggest ... I'm just trying to
figure out what you ideal end result is here.

Thanks,
Andrew



More information about the Gdb-patches mailing list