Re: [PATCH 2/6] gdb: move display of completion results into completion_result class

Eli Zaretskii
2024-04-13T09:46:29Z

> From: Andrew Burgess <aburgess@redhat.com>
> Cc: lsix@lancelotsix.com, gdb-patches@sourceware.org
> Date: Sat, 13 Apr 2024 10:09:52 +0100
>
> > Yes. Would you mind submitting a bug report about that, using the
> > command "M-x report-emacs-bug"?
>
> I absolutely will file the bug report once this series (or whatever this
> series becomes) is merged. However, I wanted to see if there were
> additional bugs hiding in the emacs code, these might indicate changes
> that need to be made (or not made) on the GDB side.
>
> So the good news is, that with a little hacking I managed to get emacs
> working!
>
> Disclaimer: My emacs lisp knowledge is pretty weak, so please consider
> this a proof of concept rather than code I'm actually suggesting should
> be merged into emacs. When I file the bug I'll include this code again,
> but by adding it here we can hopefully see what needs to change.
>
> The new and updated emacs code is at the end of this email if anyone
> wants to play with emacs and this new completion. Drop this new code
> into a file, load the emacs 'gdb' mode, then eval the new code. This
> adds some new functions, and replaces one existing function.
>
> With this in place I now get completion for filenames containing
> whitespace. Given this directory tree:
>
> /tmp/eee/
> ├── aa bb
> │ ├── f1
> │ └── f2
> └── aa cc
> ├── g1
> └── g2
>
> (gdb) file /tmp/eee/aa<TAB>
> => file /tmp/eee/aa\ <TAB>
> Possible completions are: <--- These are offered in a new buffer.
> /tmp/eee/aa\ bb/ <--- I select this entry.
> /tmp/eee/aa\ cc/
> => file /tmp/eee/aa\ bb/<TAB>
> => file /tmp/eee/aa\ bb/f<TAB>
> Possible completions are: <--- These are offered in a new buffer.
> /tmp/eee/aa\ bb/f1
> /tmp/eee/aa\ bb/f2 <--- I select this entry.
> => file /tmp/eee/aa\ bb/f2<ENTER>
> ... gdb tries to load the file ...
>
> And if also works with quoting:
>
> (gdb) file "/tmp/eee/a<TAB>
> => file "/tmp/eee/aa <TAB>
> Possible completions are: <--- These are offered in a new buffer.
> "/tmp/eee/aa bb/
> "/tmp/eee/aa cc/ <--- I select this entry.
> => file "/tmp/eee/aa cc/<TAB>
> => file "/tmp/eee/aa cc/g<TAB>
> Possible completions are: <--- These are offered in a new buffer.
> "/tmp/eee/aa cc/g1" <--- I select this entry.
> "/tmp/eee/aa cc/g2"
> => file "/tmp/eee/aa cc/g1"<ENTER>
> ... gdb tries to load the file ...
>
> As I said, I'm not claiming that emacs is "fixed", but I think I've
> shown what needs to be done to get this working, and also I've
> satisfied myself that everything can be made to work.

Thanks, please include these patches with your bug report, so that our
completion experts could review them.