]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: allow double quotes for quoting filenames
authorAndrew Burgess <aburgess@redhat.com>
Tue, 16 Jan 2024 12:21:52 +0000 (12:21 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Mon, 25 Mar 2024 17:47:43 +0000 (17:47 +0000)
commit4f440ff33d1cf8812d4f652f6fddbfa3d117268e
tree5709e9cadba2afb6f21130c0c1fa187e62fee2ff
parent5792be924413fcd2195242d87252857b888086dd
gdb: allow double quotes for quoting filenames

Currently GDB only supports using single quotes for quoting things,
the reason for this, as explained in completer.c (next to the variable
gdb_completer_expression_quote_characters) is that double quoted
strings need to be treated differently by the C expression parser.

But for filenames I don't believe this restriction holds.  The file
names as passed to things like the 'file' command are not passing
through the C expression parser, so it seems like we should be fine to
allow double quotes for quoting in this case.

And so, this commit extends GDB to allow double quotes for quoting
filenames.  Maybe in future we might be able to allow double quote
quoting in additional places, but this seems enough for now.

The testing has been extended to cover double quotes in addition to
the existing single quote testing.

This change does a number of things:

 1. Set rl_completer_quote_characters in filename_completer and
 filename_completer_handle_brkchars, this overrides the default which
 is set in complete_line_internal_1,

 2. In advance_to_completion_word we now take a set of quote
 characters as a parameter, the two callers
 advance_to_expression_complete_word_point and
 advance_to_filename_complete_word_point now pass in the required set
 of quote characters,

 3. In completion_find_completion_word we now use the currently active
 set of quote characters, this means we'll use
 gdb_completer_expression_quote_characters or
 gdb_completer_file_name_quote_characters depending on what type of
 things we are completing.
gdb/completer.c
gdb/testsuite/gdb.base/filename-completion.exp