diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-06-22 09:37:21 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-09-07 20:28:58 +0100 |
commit | dc22ab49e9b9a5d55d6608f662f808c6427600c4 (patch) | |
tree | fac0c8fba8fed88ccdc8bb03b0c25aef7324a936 | |
parent | 4076f962e8cd73219dfd48a6f682df1ab391c48c (diff) | |
download | binutils-dc22ab49e9b9a5d55d6608f662f808c6427600c4.zip binutils-dc22ab49e9b9a5d55d6608f662f808c6427600c4.tar.gz binutils-dc22ab49e9b9a5d55d6608f662f808c6427600c4.tar.bz2 |
gdb: deprecated filename_completer and associated functions
Following on from the previous commit, this commit marks the old
unquoted filename completion related functions as deprecated.
The aim of doing this is to make it more obvious to someone adding a
new command that they should not be using the older unquoted style
filename argument handling.
I split this change from the previous to make for an easier review.
This commit touches more files, but is _just_ function renaming.
Check out gdb/completer.{c,h} for what has been renamed. All the
other files have just been updated to use the new names.
There should be no user visible changes after this commit.
-rw-r--r-- | gdb/auto-load.c | 4 | ||||
-rw-r--r-- | gdb/breakpoint.c | 4 | ||||
-rw-r--r-- | gdb/cli/cli-cmds.c | 9 | ||||
-rw-r--r-- | gdb/cli/cli-decode.c | 8 | ||||
-rw-r--r-- | gdb/cli/cli-dump.c | 6 | ||||
-rw-r--r-- | gdb/compile/compile.c | 4 | ||||
-rw-r--r-- | gdb/completer.c | 23 | ||||
-rw-r--r-- | gdb/completer.h | 8 | ||||
-rw-r--r-- | gdb/corefile.c | 3 | ||||
-rw-r--r-- | gdb/corelow.c | 3 | ||||
-rw-r--r-- | gdb/dwarf2/index-write.c | 4 | ||||
-rw-r--r-- | gdb/exec.c | 3 | ||||
-rw-r--r-- | gdb/infcmd.c | 12 | ||||
-rw-r--r-- | gdb/inferior.c | 2 | ||||
-rw-r--r-- | gdb/jit.c | 2 | ||||
-rw-r--r-- | gdb/record-full.c | 4 | ||||
-rw-r--r-- | gdb/record.c | 2 | ||||
-rw-r--r-- | gdb/skip.c | 2 | ||||
-rw-r--r-- | gdb/source.c | 2 | ||||
-rw-r--r-- | gdb/symfile.c | 2 | ||||
-rw-r--r-- | gdb/target-descriptions.c | 8 | ||||
-rw-r--r-- | gdb/tracectf.c | 3 | ||||
-rw-r--r-- | gdb/tracefile-tfile.c | 3 |
23 files changed, 62 insertions, 59 deletions
diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 839be08..e753333 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -1629,7 +1629,7 @@ This option has security implications for untrusted inferiors."), See the commands 'set auto-load safe-path' and 'show auto-load safe-path' to\n\ access the current full list setting."), &cmdlist); - set_cmd_completer (cmd, filename_completer); + set_cmd_completer (cmd, deprecated_filename_completer); cmd = add_cmd ("add-auto-load-scripts-directory", class_support, add_auto_load_dir, @@ -1638,7 +1638,7 @@ access the current full list setting."), See the commands 'set auto-load scripts-directory' and\n\ 'show auto-load scripts-directory' to access the current full list setting."), &cmdlist); - set_cmd_completer (cmd, filename_completer); + set_cmd_completer (cmd, deprecated_filename_completer); add_setshow_boolean_cmd ("auto-load", class_maintenance, &debug_auto_load, _("\ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index fa19674..2860354 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -15126,14 +15126,14 @@ This includes all types of breakpoints (breakpoints, watchpoints,\n\ catchpoints, tracepoints). Use the 'source' command in another debug\n\ session to restore them."), &save_cmdlist); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); cmd_list_element *save_tracepoints_cmd = add_cmd ("tracepoints", class_trace, save_tracepoints_command, _("\ Save current tracepoint definitions as a script.\n\ Use the 'source' command in another debug session to restore them."), &save_cmdlist); - set_cmd_completer (save_tracepoints_cmd, filename_completer); + set_cmd_completer (save_tracepoints_cmd, deprecated_filename_completer); c = add_com_alias ("save-tracepoints", save_tracepoints_cmd, class_trace, 0); deprecate_cmd (c, "save tracepoints"); diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 92bb8fc..58bb62e 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -2643,7 +2643,7 @@ The debugger's current working directory specifies where scripts and other\n\ files that can be loaded by GDB are located.\n\ In order to change the inferior's current working directory, the recommended\n\ way is to use the \"set cwd\" command."), &cmdlist); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); add_com ("echo", class_support, echo_command, _("\ Print a constant string. Give string as argument.\n\ @@ -2809,7 +2809,7 @@ the previous command number shown."), = add_com ("shell", class_support, shell_command, _("\ Execute the rest of the line as a shell command.\n\ With no arguments, run an inferior shell.")); - set_cmd_completer (shell_cmd, filename_completer); + set_cmd_completer (shell_cmd, deprecated_filename_completer); add_com_alias ("!", shell_cmd, class_support, 0); @@ -2898,7 +2898,8 @@ you must type \"disassemble 'foo.c'::bar\" and not \"disassemble foo.c:bar\".")) c = add_com ("make", class_support, make_command, _("\ Run the ``make'' program using the rest of the line as arguments.")); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); + c = add_cmd ("user", no_class, show_user, _("\ Show definitions of non-python/scheme user defined commands.\n\ Argument is the name of the user defined command.\n\ @@ -2982,5 +2983,5 @@ Note that the file \"%s\" is read automatically in this way\n\ when GDB is started."), GDBINIT).release (); c = add_cmd ("source", class_support, source_command, source_help_text, &cmdlist); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); } diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index d9a2ab4..163012a 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -866,7 +866,7 @@ add_setshow_filename_cmd (const char *name, enum command_class theclass, nullptr, nullptr, set_func, show_func, set_list, show_list); - set_cmd_completer (commands.set, filename_completer); + set_cmd_completer (commands.set, deprecated_filename_completer); return commands; } @@ -890,7 +890,7 @@ add_setshow_filename_cmd (const char *name, command_class theclass, nullptr, show_func, set_list, show_list); - set_cmd_completer (cmds.set, filename_completer); + set_cmd_completer (cmds.set, deprecated_filename_completer); return cmds; } @@ -1015,7 +1015,7 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class theclass nullptr, nullptr, set_func, show_func, set_list, show_list); - set_cmd_completer (commands.set, filename_completer); + set_cmd_completer (commands.set, deprecated_filename_completer); return commands; } @@ -1039,7 +1039,7 @@ add_setshow_optional_filename_cmd (const char *name, command_class theclass, set_func, get_func, nullptr, show_func, set_list,show_list); - set_cmd_completer (cmds.set, filename_completer); + set_cmd_completer (cmds.set, deprecated_filename_completer); return cmds; } diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 9b44c6e..2b9307e 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -348,7 +348,7 @@ add_dump_command (const char *name, struct dump_context *d; c = add_cmd (name, all_commands, descr, &dump_cmdlist); - c->completer = filename_completer; + set_cmd_completer (c, deprecated_filename_completer); d = XNEW (struct dump_context); d->func = func; d->mode = FOPEN_WB; @@ -356,7 +356,7 @@ add_dump_command (const char *name, c->func = call_dump_func; c = add_cmd (name, all_commands, descr, &append_cmdlist); - c->completer = filename_completer; + set_cmd_completer (c, deprecated_filename_completer); d = XNEW (struct dump_context); d->func = func; d->mode = FOPEN_AB; @@ -705,6 +705,6 @@ Arguments are FILE OFFSET START END where all except FILE are optional.\n\ OFFSET will be added to the base address of the file (default zero).\n\ If START and END are given, only the file contents within that range\n\ (file relative) will be restored to target memory.")); - c->completer = filename_completer; + set_cmd_completer (c, deprecated_filename_completer); /* FIXME: completers for other commands. */ } diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index 8896b44..6c5f33e 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -328,8 +328,8 @@ compile_file_command_completer (struct cmd_list_element *ignore, (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group)) return; - word = advance_to_filename_complete_word_point (tracker, text); - filename_completer (ignore, tracker, text, word); + word = advance_to_deprecated_filename_complete_word_point (tracker, text); + deprecated_filename_completer (ignore, tracker, text, word); } /* Handle the input from the 'compile code' command. The diff --git a/gdb/completer.c b/gdb/completer.c index 93eb8db..0e49549 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -291,7 +291,7 @@ filename_maybe_quoted_completer (struct cmd_list_element *ignore, filenames. */ static void -filename_completer_handle_brkchars +deprecated_filename_completer_handle_brkchars (struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word) { @@ -302,14 +302,14 @@ filename_completer_handle_brkchars rl_filename_quoting_desired = 0; tracker.set_use_custom_word_point (true); - word = advance_to_filename_complete_word_point (tracker, text); - filename_completer (ignore, tracker, text, word); + word = advance_to_deprecated_filename_complete_word_point (tracker, text); + deprecated_filename_completer (ignore, tracker, text, word); } /* See completer.h. */ void -filename_completer +deprecated_filename_completer (struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word) { @@ -499,8 +499,8 @@ advance_to_expression_complete_word_point (completion_tracker &tracker, /* See completer.h. */ const char * -advance_to_filename_complete_word_point (completion_tracker &tracker, - const char *text) +advance_to_deprecated_filename_complete_word_point + (completion_tracker &tracker, const char *text) { const char *brk_chars = gdb_completer_path_break_characters; const char *quote_chars = nullptr; @@ -662,8 +662,8 @@ complete_files_symbols (completion_tracker &tracker, symbol_start, word); /* If text includes characters which cannot appear in a file name, they cannot be asking for completion on files. */ - if (strcspn (text, - gdb_completer_file_name_break_characters) == text_len) + if (strcspn (text, gdb_completer_file_name_break_characters) + == text_len) fn_list = make_source_files_completion_list (text, text); } @@ -713,8 +713,7 @@ complete_source_filenames (const char *text) /* If text includes characters which cannot appear in a file name, the user cannot be asking for completion on files. */ - if (strcspn (text, - gdb_completer_file_name_break_characters) + if (strcspn (text, gdb_completer_file_name_break_characters) == text_len) return make_source_files_completion_list (text, text); @@ -1932,8 +1931,8 @@ default_completer_handle_brkchars (struct cmd_list_element *ignore, completer_handle_brkchars_ftype * completer_handle_brkchars_func_for_completer (completer_ftype *fn) { - if (fn == filename_completer) - return filename_completer_handle_brkchars; + if (fn == deprecated_filename_completer) + return deprecated_filename_completer_handle_brkchars; if (fn == filename_maybe_quoted_completer) return filename_maybe_quoted_completer_handle_brkchars; diff --git a/gdb/completer.h b/gdb/completer.h index c6d064e..70f123e 100644 --- a/gdb/completer.h +++ b/gdb/completer.h @@ -567,7 +567,7 @@ const char *advance_to_expression_complete_word_point emulating the algorithm readline uses to find the word point. The filenames that are located by this function assume no filename quoting, this function should be paired with filename_completer. */ -extern const char *advance_to_filename_complete_word_point +extern const char *advance_to_deprecated_filename_complete_word_point (completion_tracker &tracker, const char *text); extern void noop_completer (struct cmd_list_element *, @@ -582,9 +582,9 @@ extern void noop_completer (struct cmd_list_element *, accepts quoted filenames and use filename_maybe_quoted_completer, for examples see the 'exec' and 'exec-file' commands. */ -extern void filename_completer (struct cmd_list_element *, - completion_tracker &tracker, - const char *, const char *); +extern void deprecated_filename_completer + (struct cmd_list_element *, completion_tracker &tracker, + const char *, const char *); /* Filename completer for commands where the filename argument can be quoted. This completer also supports completing a list of filenames diff --git a/gdb/corefile.c b/gdb/corefile.c index 96052cf..f6ec3cd 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -391,9 +391,8 @@ Use FILE as core dump for examining memory and registers.\n\ Usage: core-file FILE\n\ No arg means have no core file. This command has been superseded by the\n\ `target core' and `detach' commands."), &cmdlist); - set_cmd_completer (core_file_cmd, filename_completer); + set_cmd_completer (core_file_cmd, deprecated_filename_completer); - set_show_commands set_show_gnutarget = add_setshow_string_noescape_cmd ("gnutarget", class_files, &gnutarget_string, _("\ diff --git a/gdb/corelow.c b/gdb/corelow.c index 2e9253d..99a61fc 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -1939,7 +1939,8 @@ void _initialize_corelow (); void _initialize_corelow () { - add_target (core_target_info, core_target_open, filename_completer); + add_target (core_target_info, core_target_open, + deprecated_filename_completer); add_cmd ("core-file-backed-mappings", class_maintenance, maintenance_print_core_file_backed_mappings, _("Print core file's file-backed mappings."), diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index a845d87..26907b7 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -1618,8 +1618,8 @@ gdb_save_index_cmd_completer (struct cmd_list_element *ignore, (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp)) return; - word = advance_to_filename_complete_word_point (tracker, text); - filename_completer (ignore, tracker, text, word); + word = advance_to_deprecated_filename_complete_word_point (tracker, text); + deprecated_filename_completer (ignore, tracker, text, word); } /* Implementation of the `save gdb-index' command. @@ -1119,5 +1119,6 @@ will be loaded as well."), show_exec_file_mismatch_command, &setlist, &showlist); - add_target (exec_target_info, exec_target_open, filename_completer); + add_target (exec_target_info, exec_target_open, + deprecated_filename_completer); } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 90fa4f6..5e9af41 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -3113,7 +3113,7 @@ Follow this command with any number of args, to be passed to the program."), get_args_value, show_args_command, &setlist, &showlist); - set_cmd_completer (args_set_show.set, filename_completer); + set_cmd_completer (args_set_show.set, deprecated_filename_completer); auto cwd_set_show = add_setshow_string_noescape_cmd ("cwd", class_run, _("\ @@ -3129,7 +3129,7 @@ working directory."), set_cwd_value, get_inferior_cwd, show_cwd_command, &setlist, &showlist); - set_cmd_completer (cwd_set_show.set, filename_completer); + set_cmd_completer (cwd_set_show.set, deprecated_filename_completer); c = add_cmd ("environment", no_class, environment_info, _("\ The environment to give the program, or one variable's value.\n\ @@ -3163,7 +3163,7 @@ This path is equivalent to the $PATH shell variable. It is a list of\n\ directories, separated by colons. These directories are searched to find\n\ fully linked executable files and separately compiled object files as \ needed.")); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); c = add_cmd ("paths", no_class, path_info, _("\ Current search path for finding object files.\n\ @@ -3313,18 +3313,18 @@ Specifying -a and an ignore count simultaneously is an error.")); = add_com ("run", class_run, run_command, _("\ Start debugged program.\n" RUN_ARGS_HELP)); - set_cmd_completer (run_cmd, filename_completer); + set_cmd_completer (run_cmd, deprecated_filename_completer); add_com_alias ("r", run_cmd, class_run, 1); c = add_com ("start", class_run, start_command, _("\ Start the debugged program stopping at the beginning of the main procedure.\n" RUN_ARGS_HELP)); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); c = add_com ("starti", class_run, starti_command, _("\ Start the debugged program stopping at the first instruction.\n" RUN_ARGS_HELP)); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); add_com ("interrupt", class_run, interrupt_command, _("Interrupt the execution of the debugged program.\n\ diff --git a/gdb/inferior.c b/gdb/inferior.c index bc9e5ee..21f37c8 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -1116,7 +1116,7 @@ as main program.\n\ By default, the new inferior inherits the current inferior's connection.\n\ If -no-connection is specified, the new inferior begins with\n\ no target connection yet.")); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); add_com ("remove-inferiors", no_class, remove_inferior_command, _("\ Remove inferior ID (or list of IDs).\n\ @@ -1329,7 +1329,7 @@ Usage: jit-reader-load FILE\n\ Try to load file FILE as a debug info reader (and unwinder) for\n\ JIT compiled code. The file is loaded from " JIT_READER_DIR ",\n\ relocated relative to the GDB executable if required.")); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); c = add_com ("jit-reader-unload", no_class, jit_reader_unload_command, _("\ diff --git a/gdb/record-full.c b/gdb/record-full.c index ab854e0..a681ef9 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -2892,12 +2892,12 @@ _initialize_record_full () _("Restore the execution log from a file.\n\ Argument is filename. File must be created with 'record save'."), &record_full_cmdlist); - set_cmd_completer (record_full_restore_cmd, filename_completer); + set_cmd_completer (record_full_restore_cmd, deprecated_filename_completer); /* Deprecate the old version without "full" prefix. */ c = add_alias_cmd ("restore", record_full_restore_cmd, class_obscure, 1, &record_cmdlist); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); deprecate_cmd (c, "record full restore"); add_setshow_prefix_cmd ("full", class_support, diff --git a/gdb/record.c b/gdb/record.c index d84af60..8bf8a69 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -827,7 +827,7 @@ A size of \"unlimited\" means unlimited lines. The default is 10."), Usage: record save [FILENAME]\n\ Default filename is 'gdb_record.PROCESS_ID'."), &record_cmdlist); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); cmd_list_element *record_delete_cmd = add_cmd ("delete", class_obscure, cmd_record_delete, @@ -684,7 +684,7 @@ Ignore a file while stepping.\n\ Usage: skip file [FILE-NAME]\n\ If no filename is given, ignore the current file."), &skiplist); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); c = add_cmd ("function", class_breakpoint, skip_function_command, _("\ Ignore a function while stepping.\n\ diff --git a/gdb/source.c b/gdb/source.c index 0c5c2ba..b9122c4 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1915,7 +1915,7 @@ directory in which the source file was compiled into object code.\n\ With no argument, reset the search path to $cdir:$cwd, the default."), &cmdlist); - set_cmd_completer (directory_cmd, filename_completer); + set_cmd_completer (directory_cmd, deprecated_filename_completer); add_setshow_optional_filename_cmd ("directories", class_files, diff --git a/gdb/symfile.c b/gdb/symfile.c index c3cd961..5054d10 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3846,7 +3846,7 @@ Usage: load [FILE] [OFFSET]\n\ An optional load OFFSET may also be given as a literal address.\n\ When OFFSET is provided, FILE must also be provided. FILE can be provided\n\ on its own."), &cmdlist); - set_cmd_completer (c, filename_completer); + set_cmd_completer (c, deprecated_filename_completer); cmd_list_element *overlay_cmd = add_basic_prefix_cmd ("overlay", class_support, diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 4bb48fc..d3ee4e9 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -1760,8 +1760,8 @@ maint_print_c_tdesc_cmd_completer (struct cmd_list_element *ignore, (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp)) return; - word = advance_to_filename_complete_word_point (tracker, text); - filename_completer (ignore, tracker, text, word); + word = advance_to_deprecated_filename_complete_word_point (tracker, text); + deprecated_filename_completer (ignore, tracker, text, word); } /* Implement the maintenance print xml-tdesc command. */ @@ -1945,7 +1945,7 @@ that feature within an already existing target_desc object."), grp); cmd = add_cmd ("xml-tdesc", class_maintenance, maint_print_xml_tdesc_cmd, _("\ Print the current target description as an XML file."), &maintenanceprintlist); - set_cmd_completer (cmd, filename_completer); + set_cmd_completer (cmd, deprecated_filename_completer); cmd = add_cmd ("xml-descriptions", class_maintenance, maintenance_check_xml_descriptions, _("\ @@ -1954,5 +1954,5 @@ Check the target descriptions created in GDB equal the descriptions\n\ created from XML files in the directory.\n\ The parameter is the directory name."), &maintenancechecklist); - set_cmd_completer (cmd, filename_completer); + set_cmd_completer (cmd, deprecated_filename_completer); } diff --git a/gdb/tracectf.c b/gdb/tracectf.c index 282a825..25a8fe7 100644 --- a/gdb/tracectf.c +++ b/gdb/tracectf.c @@ -1721,6 +1721,7 @@ void _initialize_ctf () { #if HAVE_LIBBABELTRACE - add_target (ctf_target_info, ctf_target_open, filename_completer); + add_target (ctf_target_info, ctf_target_open, + deprecated_filename_completer); #endif } diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 4a4c4a2..6676921 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -1120,5 +1120,6 @@ void _initialize_tracefile_tfile (); void _initialize_tracefile_tfile () { - add_target (tfile_target_info, tfile_target_open, filename_completer); + add_target (tfile_target_info, tfile_target_open, + deprecated_filename_completer); } |