diff options
Diffstat (limited to 'gdb/completer.c')
| -rw-r--r-- | gdb/completer.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/gdb/completer.c b/gdb/completer.c index 4735aa5..677b9d1 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -1,5 +1,5 @@ /* Line completion stuff for GDB, the GNU debugger. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -160,7 +160,7 @@ enum explicit_location_match_type will quote it. That's why we switch between current_language->word_break_characters () and gdb_completer_command_word_break_characters. I'm not sure when - we need this behavior (perhaps for funky characters in C++ + we need this behavior (perhaps for funky characters in C++ symbols?). */ /* Variables which are necessary for fancy command line editing. */ @@ -212,7 +212,7 @@ static const char gdb_completer_file_name_quote_characters[] = "'\""; symbols but don't want to complete on anything else either. */ void -noop_completer (struct cmd_list_element *ignore, +noop_completer (struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *prefix) { @@ -356,7 +356,7 @@ gdb_completer_file_name_quote_1 (const char *text, char quote_char) if (quote_char == '\'') { /* There is no backslash escaping permitted within a single quoted - string, so in this case we can just return the input sting. */ + string, so in this case we can just return the input string. */ str = text; } else if (quote_char == '"') @@ -1008,7 +1008,7 @@ complete_files_symbols (completion_tracker &tracker, name, they cannot be asking for completion on files. */ if (strcspn (text, gdb_completer_file_name_break_characters) == text_len) - fn_list = make_source_files_completion_list (text, text); + fn_list = make_source_files_completion_list (text); } if (!fn_list.empty () && !tracker.have_completions ()) @@ -1059,7 +1059,7 @@ complete_source_filenames (const char *text) the user cannot be asking for completion on files. */ if (strcspn (text, gdb_completer_file_name_break_characters) == text_len) - return make_source_files_completion_list (text, text); + return make_source_files_completion_list (text); return {}; } @@ -1142,7 +1142,7 @@ collect_explicit_location_matches (completion_tracker &tracker, const char *source = string_or_empty (explicit_loc->source_filename.get ()); completion_list matches - = make_source_files_completion_list (source, source); + = make_source_files_completion_list (source); tracker.add_completions (std::move (matches)); } break; @@ -2164,7 +2164,7 @@ complete_line (completion_tracker &tracker, /* Complete on command names. Used by "help". */ void -command_completer (struct cmd_list_element *ignore, +command_completer (struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word) { @@ -3006,7 +3006,7 @@ gdb_printable_part (char *pathname) temp = strrchr (pathname, '/'); #if defined (__MSDOS__) - if (temp == 0 && ISALPHA ((unsigned char)pathname[0]) && pathname[1] == ':') + if (temp == 0 && c_isalpha (pathname[0]) && pathname[1] == ':') temp = pathname + 1; #endif @@ -3183,7 +3183,7 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes, const struct match_list_displayer *displayer) { int printed_len, extension_char, slen, tlen; - char *s, c, *new_full_pathname; + char c, *new_full_pathname; const char *dn; extern int _rl_complete_mark_directories; @@ -3220,7 +3220,7 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes, dn = "/"; /* don't turn /// into // */ else dn = full_pathname; - s = tilde_expand (dn); + char *s = gdb_rl_tilde_expand (dn).release (); if (rl_directory_completion_hook) (*rl_directory_completion_hook) (&s); @@ -3245,20 +3245,22 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes, xfree (new_full_pathname); to_print[-1] = c; + + xfree (s); } else { - s = tilde_expand (full_pathname); + gdb::unique_xmalloc_ptr<char> s + = gdb_rl_tilde_expand (full_pathname); #if defined (VISIBLE_STATS) if (rl_visible_stats) extension_char = stat_char (s); else #endif - if (gdb_path_isdir (s)) + if (gdb_path_isdir (s.get ())) extension_char = '/'; } - xfree (s); if (extension_char) { displayer->putch (displayer, extension_char); @@ -3513,9 +3515,7 @@ skip_over_slash_fmt (completion_tracker &tracker, const char **args) return false; } -void _initialize_completer (); -void -_initialize_completer () +INIT_GDB_FILE (completer) { /* Setup some readline completion globals. */ rl_completion_word_break_hook = gdb_completion_word_break_characters; |
