Difficulty with the readline completion interface in GDB
Daniel Jacobowitz
drow@mvista.com
Sun Jan 18 22:49:00 GMT 2004
Hi Chet,
I've spent this morning trying to fix a long-standing bug in GDB's tab
completion. I think it's unsolvable with the current readline interface, so
I'd like your suggestions on how to improve the situation.
The gist of the problem is that different parts of the command line have
different word break characters. For example, '/' is a word break character
after a command or a symbol, but not after a directory name. There's no way
to explain this to Readline. Right now, we do a lot of fudging
rl_completer_word_break_chars, but it's never quite in time. As a result,
we get this chain of events:
- rl_completer_word_break_chars contains '/' and '.'
- The user enters "file ./gdb.base<TAB>"
- GDB's complete_line is called from rl_complete. The text parameter
is "base", because . was treated as a word separator.
- We return, and readline stats the file to figure out whether to add
a slash after it. It stats "base", having lost the "./gdb.". Stat
fails.
- A space is inserted instead of the slash (gdb.base is a directory).
There's a lot of possible solutions. There could be a hook called before
rl_complete generates the matches list, which could fudge the complete
characters - most direct solution, not very elegant. A function could be
called to get the list of complete characters, which would then be sensitive
to rl_point - not sure what other issues this could cause. The filename
completion code could search backwards according to the list of filename
wordbreak characters; this would solve the specific problem but not the
more general one. Probably there are others.
What do you think?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Gdb
mailing list