sequences as strings. */
static const char gdb_completer_quote_characters[] = "'";
\f
-/* Accessor for some completer data that may interest other files. */
-
-const char *
-get_gdb_completer_quote_characters (void)
-{
- return gdb_completer_quote_characters;
-}
/* This can be used for functions which don't want to complete on
symbols but don't want to complete on anything else either. */
set_rl_completer_word_break_characters
(current_language->word_break_characters ());
+ /* Likewise for the quote characters. */
+ rl_completer_quote_characters = gdb_completer_quote_characters;
+
/* Decide whether to complete on a list of gdb commands or on
symbols. */
tmp_command = (char *) alloca (point + 1);
remote_exec host "mkdir -p ${root}/cc1"
remote_exec host "touch ${root}/cc2"
+ remote_exec host "touch \"${root}/aaa/aa bb\""
+ remote_exec host "touch \"${root}/aaa/aa cc\""
+
return $root
}
# sub-directory of the user's home directory ROOT might have been
# modified to replace the $HOME prefix with a single "~" character.
proc run_tests { root } {
- test_gdb_complete_none "file ${root}/xx" \
- "expand a non-existent filename"
-
- test_gdb_complete_unique "file ${root}/a" \
- "file ${root}/aaa/" "" false \
- "expand a unique filename"
-
- test_gdb_complete_multiple "file ${root}/" \
- "b" "b" {
- "bb1/"
- "bb2/"
- } "" "" false \
- "expand multiple directory names"
-
- test_gdb_complete_multiple "file ${root}/" \
- "c" "c" {
- "cc1/"
- "cc2"
- } "" "" false \
- "expand mixed directory and file names"
+
+ # Completing 'thread apply all ...' commands uses a custom word
+ # point. At one point we had a bug where doing this would break
+ # completion of quoted filenames that contained white space.
+ test_gdb_complete_unique "thread apply all hel" \
+ "thread apply all help" " " false \
+ "complete a 'thread apply all' command"
+
+ foreach_with_prefix qc [list "" "'"] {
+ test_gdb_complete_none "file ${qc}${root}/xx" \
+ "expand a non-existent filename"
+
+ test_gdb_complete_unique "file ${qc}${root}/a" \
+ "file ${qc}${root}/aaa/" "" false \
+ "expand a unique filename"
+
+ test_gdb_complete_multiple "file ${qc}${root}/" \
+ "b" "b" {
+ "bb1/"
+ "bb2/"
+ } "" "${qc}" false \
+ "expand multiple directory names"
+
+ test_gdb_complete_multiple "file ${qc}${root}/" \
+ "c" "c" {
+ "cc1/"
+ "cc2"
+ } "" "${qc}" false \
+ "expand mixed directory and file names"
+
+ # GDB does not currently escape word break characters
+ # (e.g. white space) correctly in unquoted filenames.
+ if { $qc ne "" } {
+ set sp " "
+
+ test_gdb_complete_multiple "file ${qc}${root}/aaa/" \
+ "a" "a${sp}" {
+ "aa bb"
+ "aa cc"
+ } "" "${qc}" false \
+ "expand filenames containing spaces"
+ }
+ }
}
gdb_start
rl_completion_word_break_hook = gdb_completion_word_break_characters;
rl_attempted_completion_function = gdb_rl_attempted_completion_function;
set_rl_completer_word_break_characters (default_word_break_characters ());
- rl_completer_quote_characters = get_gdb_completer_quote_characters ();
rl_completion_display_matches_hook = cli_display_match_list;
rl_readline_name = "gdb";
rl_terminal_name = getenv ("TERM");