mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-27 09:38:57 +00:00
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.
This commit is contained in:
@@ -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, _("\
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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. */
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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, _("\
|
||||
|
||||
@@ -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."),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
12
gdb/infcmd.c
12
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\
|
||||
|
||||
@@ -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, _("\
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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\
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user