* command.h (set_cmd_completer): Declare.
* cli/cli-decode.h (set_cmd_completer): Ditto.
* breakpoint.c (_initialize_breakpoint): Use set_cmd_completer.
* cli/cli-cmds.c (init_cli_cmds): Ditto.
* win32-nat.c (_initialize_inftarg): Ditto.
* remote-rdi.c (_initialize_remote_rdi): Ditto.
* proc-api.c (_initialize_proc_api): Ditto.
* hppa-tdep.c (_initialize_hppa_tdep): Ditto.
* source.c (_initialize_source): Ditto.
* exec.c (_initialize_exec): Ditto.
* solib.c (_initialize_solib): Ditto.
* top.c (init_main): Ditto.
* tracepoint.c (_initialize_tracepoint): Ditto.
* symfile.c (_initialize_symfile): Ditto.
* printcmd.c (_initialize_printcmd): Ditto.
* infcmd.c (_initialize_infcmd): Ditto.
* corefile.c (_initialize_core): Ditto.
+2002-03-06 Andrew Cagney <ac131313@redhat.com>
+
+ * cli/cli-decode.c (set_cmd_completer): New function.
+ * command.h (set_cmd_completer): Declare.
+ * cli/cli-decode.h (set_cmd_completer): Ditto.
+
+ * breakpoint.c (_initialize_breakpoint): Use set_cmd_completer.
+ * cli/cli-cmds.c (init_cli_cmds): Ditto.
+ * win32-nat.c (_initialize_inftarg): Ditto.
+ * remote-rdi.c (_initialize_remote_rdi): Ditto.
+ * proc-api.c (_initialize_proc_api): Ditto.
+ * hppa-tdep.c (_initialize_hppa_tdep): Ditto.
+ * source.c (_initialize_source): Ditto.
+ * exec.c (_initialize_exec): Ditto.
+ * solib.c (_initialize_solib): Ditto.
+ * top.c (init_main): Ditto.
+ * tracepoint.c (_initialize_tracepoint): Ditto.
+ * symfile.c (_initialize_symfile): Ditto.
+ * printcmd.c (_initialize_printcmd): Ditto.
+ * infcmd.c (_initialize_infcmd): Ditto.
+ * corefile.c (_initialize_core): Ditto.
+
2002-03-05 Andrew Cagney <ac131313@redhat.com>
* MAINTAINERS (Past Maintainers): Add Frank Ch. Eigler.
Like \"break\" except the breakpoint is only temporary,\n\
so it will be deleted when hit. Equivalent to \"break\" followed\n\
by using \"enable delete\" on the breakpoint number.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
c = add_com ("hbreak", class_breakpoint, hbreak_command,
"Set a hardware assisted breakpoint. Args like \"break\" command.\n\
Like \"break\" except the breakpoint requires hardware support,\n\
some target hardware may not have this support.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
c = add_com ("thbreak", class_breakpoint, thbreak_command,
"Set a temporary hardware assisted breakpoint. Args like \"break\" command.\n\
Like \"hbreak\" except the breakpoint is only temporary,\n\
so it will be deleted when hit.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
add_prefix_cmd ("enable", class_breakpoint, enable_command,
"Enable some breakpoints.\n\
Multiple breakpoints at one place are permitted, and useful if conditional.\n\
\n\
Do \"help breakpoints\" for info on other commands dealing with breakpoints.", NULL));
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
add_com_alias ("b", "break", class_run, 1);
add_com_alias ("br", "break", class_run, 1);
"Set a watchpoint for an expression.\n\
A watchpoint stops execution of your program whenever the value of\n\
an expression changes.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
c = add_com ("rwatch", class_breakpoint, rwatch_command,
"Set a read watchpoint for an expression.\n\
A watchpoint stops execution of your program whenever the value of\n\
an expression is read.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
c = add_com ("awatch", class_breakpoint, awatch_command,
"Set a watchpoint for an expression.\n\
A watchpoint stops execution of your program whenever the value of\n\
an expression is either read or written.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
add_info ("watchpoints", breakpoints_info,
"Synonym for ``info breakpoints''.");
"Set working directory to DIR for debugger and program being debugged.\n\
The change does not take effect for the program being debugged\n\
until the next time it is started.", &cmdlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_com ("echo", class_support, echo_command,
"Print a constant string. Give string as argument.\n\
"Read commands from a file named FILE.\n\
Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\
when gdb is started.", &cmdlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_com ("quit", class_support, quit_command, "Exit gdb.");
c = add_com ("help", class_support, help_command, "Print list of commands.");
- c->completer = command_completer;
+ set_cmd_completer (c, command_completer);
add_com_alias ("q", "quit", class_support, 1);
add_com_alias ("h", "help", class_support, 1);
c = add_com ("shell", class_support, shell_escape,
"Execute the rest of the line as a shell command. \n\
With no arguments, run an inferior shell.");
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
/* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
be a really useful feature. Unfortunately, the below wont do
c = add_com ("make", class_support, make_command,
"Run the ``make'' program using the rest of the line as arguments.");
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_cmd ("user", no_class, show_user,
"Show definitions of user defined commands.\n\
Argument is the name of the user defined command.\n\
return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
}
+void
+set_cmd_completer (struct cmd_list_element *cmd,
+ char **(*completer) (char *text, char *word))
+{
+ cmd->completer = completer; /* Ok. */
+}
+
/* Add element named NAME.
CLASS is the top level category into which commands are broken down
c->prefixname = NULL;
c->allow_unknown = 0;
c->abbrev_flag = 0;
- c->completer = make_symbol_completion_list;
+ set_cmd_completer (c, make_symbol_completion_list);
c->type = not_set_cmd;
c->var = NULL;
c->var_type = var_boolean;
void (*sfunc) (char *args, int from_tty,
struct cmd_list_element * c));
+extern void set_cmd_completer (struct cmd_list_element *cmd,
+ char **(*completer) (char *text, char *word));
+
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
around in cmd objects to test the value of the commands sfunc(). */
extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
void (*sfunc) (char *args, int from_tty,
struct cmd_list_element * c));
+extern void set_cmd_completer (struct cmd_list_element *cmd,
+ char **(*completer) (char *text, char *word));
+
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
around in cmd objects to test the value of the commands sfunc(). */
extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
"Use FILE as core dump for examining memory and registers.\n\
No arg means have no core file. This command has been superseded by the\n\
`target core' and `detach' commands.", &cmdlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
c = add_set_cmd ("gnutarget", class_files, var_string_noescape,
(char *) &gnutarget_string,
If FILE cannot be found as specified, your execution directory path\n\
($PATH) is searched for a command of that name.\n\
No arg means to have no executable file and no symbols.", &cmdlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
}
c = add_cmd ("exec-file", class_files, exec_file_command,
If FILE cannot be found as specified, your execution directory path\n\
is searched for a command of that name.\n\
No arg means have no executable file.", &cmdlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_com ("section", class_files, set_section_command,
"Change the base address of section SECTION of the exec file to ADDR.\n\
tbreak_at_finish_command,
"Set temporary breakpoint at procedure exit. Either there should\n\
be no argument or the argument must be a depth.\n"), NULL);
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
if (xdb_commands)
deprecate_cmd (add_com ("bx", class_breakpoint,
c = add_com ("tty", class_run, tty_command,
"Set terminal for future runs of program being debugged.");
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
c = add_set_cmd ("args", class_run, var_string_noescape,
(char *) &inferior_args,
"Set argument list to give program being debugged when it is started.\n\
Follow this command with any number of args, to be passed to the program.",
&setlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
set_cmd_sfunc (c, notice_args_set);
c = add_show_from_set (c, &showlist);
set_cmd_sfunc (c, notice_args_read);
With an argument VAR, prints the value of environment variable VAR to\n\
give the program being debugged. With no arguments, prints the entire\n\
environment to be given to the program.", &showlist);
- c->completer = noop_completer;
+ set_cmd_completer (c, noop_completer);
add_prefix_cmd ("unset", no_class, unset_command,
"Complement to certain \"set\" commands",
"Cancel environment variable VAR for the program.\n\
This does not affect the program until the next \"run\" command.",
&unsetlist);
- c->completer = noop_completer;
+ set_cmd_completer (c, noop_completer);
c = add_cmd ("environment", class_run, set_environment_command,
"Set environment variable value to give the program.\n\
VALUES of environment variables are uninterpreted strings.\n\
This does not affect the program until the next \"run\" command.",
&setlist);
- c->completer = noop_completer;
+ set_cmd_completer (c, noop_completer);
c = add_com ("path", class_files, path_command,
"Add directory DIR(s) to beginning of search path for object files.\n\
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.");
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
c = add_cmd ("paths", no_class, path_info,
"Current search path for finding object files.\n\
directories, separated by colons. These directories are searched to find\n\
fully linked executable files and separately compiled object files as needed.",
&showlist);
- c->completer = noop_completer;
+ set_cmd_completer (c, noop_completer);
add_com ("attach", class_run, attach_command,
"Attach to a process or file outside of GDB.\n\
"Execute until the program reaches a source line greater than the current\n\
or a specified line or address or function (same args as break command).\n\
Execution will also stop upon exit from the current stack frame.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
add_com_alias ("u", "until", class_run, 1);
c = add_com ("jump", class_run, jump_command,
"Continue program being debugged at specified line or address.\n\
Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
for an address to start at.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
if (xdb_commands)
{
Give as argument either LINENUM or *ADDR, where ADDR is an \n\
expression for an address to start at.\n\
This command is a combination of tbreak and jump.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
}
if (xdb_commands)
With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
To cancel previous arguments and run with no arguments,\n\
use \"set args\" without arguments.");
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_com_alias ("r", "run", class_run, 1);
if (xdb_commands)
add_com ("R", class_run, run_no_args_command,
Default is the function surrounding the pc of the selected frame.\n\
With a single argument, the function surrounding that address is dumped.\n\
Two arguments are taken as a range of memory to dump.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
if (xdb_commands)
add_com_alias ("va", "disassemble", class_xdb, 0);
The argument is the function name and arguments, in the notation of the\n\
current working language. The result is printed and saved in the value\n\
history, if it is not void.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
add_cmd ("variable", class_vars, set_command,
"Evaluate expression EXP and assign result to variable VAR, using assignment\n\
"\n\
EXP may be preceded with /FMT, where FMT is a format letter\n\
but no count or size letter (see \"x\" command).", NULL));
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
add_com_alias ("p", "print", class_vars, 1);
c = add_com ("inspect", class_vars, inspect_command,
"Same as \"print\" command, except that if you are running in the epoch\n\
environment, the value is printed in its own window.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
add_show_from_set (
add_set_cmd ("max-symbolic-offset", no_class, var_uinteger,
add_show_from_set (c, &showlist);
set_cmd_sfunc (c, set_procfs_trace_cmd);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
c = add_set_cmd ("procfs-file", no_class, var_filename,
(char *) &procfs_filename,
Without an argument, shows the current logfile name.\n\
See also: rdilogenable\n",
&maintenancelist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_cmd ("rdilogenable", class_maintenance,
rdilogenable_command,
For other (relative) files, you can add values using `set solib-search-path'.",
&setlist);
add_show_from_set (c, &showlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
c = add_set_cmd ("solib-search-path", class_support, var_string,
(char *) &solib_search_path,
This takes precedence over the environment variables PATH and LD_LIBRARY_PATH.",
&setlist);
add_show_from_set (c, &showlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
}
if (dbx_commands)
add_com_alias ("use", "directory", class_files, 0);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_cmd ("directories", no_class, show_directories,
"Current search path for finding source files.\n\
"Load symbol table from executable file FILE.\n\
The `file' command can also load symbol tables, as well as setting the file\n\
to execute.", &cmdlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
c = add_cmd ("add-symbol-file", class_files, add_symbol_file_command,
"Usage: add-symbol-file FILE ADDR [-s <SECT> <SECT_ADDR> -s <SECT> <SECT_ADDR> ...]\n\
should be specified if the data and bss segments are not contiguous\n\
with the text. SECT is a section name to be loaded at SECT_ADDR.",
&cmdlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
c = add_cmd ("add-shared-symbol-files", class_files,
add_shared_symbol_files_command,
c = add_cmd ("load", class_files, load_command,
"Dynamically load FILE into the running program, and record its symbols\n\
for access from GDB.", &cmdlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_show_from_set
(add_set_cmd ("symbol-reloading", class_support, var_boolean,
(char *) &history_filename,
"Set the filename in which to record the command history\n\
(the list of previous commands of which a record is kept).", &sethistlist);
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_show_from_set (c, &showhistlist);
add_show_from_set
c = add_com ("save-tracepoints", class_trace, tracepoint_save_command,
"Save current tracepoint definitions as a script.\n\
Use the 'source' command in another debug session to restore them.");
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
add_com ("tdump", class_trace, trace_dump_command,
"Print everything collected at the current tracepoint.");
For a line number or function, trace at the start of its code.\n\
If an address is specified, trace at that exact address.\n\n\
Do \"help tracepoints\" for info on other tracepoint commands.");
- c->completer = location_completer;
+ set_cmd_completer (c, location_completer);
add_com_alias ("tp", "trace", class_alias, 0);
add_com_alias ("tr", "trace", class_alias, 1);
c = add_com ("dll-symbols", class_files, dll_symbol_command,
"Load dll library symbols from FILE.");
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
sh = getenv ("SHELL");
if (!sh)
c = add_com ("dll-symbols", class_files, dll_symbol_command,
"Load dll library symbols from FILE.");
- c->completer = filename_completer;
+ set_cmd_completer (c, filename_completer);
sh = getenv ("SHELL");
if (!sh)