aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog22
-rw-r--r--gdb/breakpoint.c14
-rw-r--r--gdb/cli/cli-cmds.c10
-rw-r--r--gdb/cli/cli-decode.c9
-rw-r--r--gdb/cli/cli-decode.h3
-rw-r--r--gdb/command.h3
-rw-r--r--gdb/corefile.c2
-rw-r--r--gdb/exec.c4
-rw-r--r--gdb/hppa-tdep.c2
-rw-r--r--gdb/infcmd.c22
-rw-r--r--gdb/printcmd.c8
-rw-r--r--gdb/proc-api.c2
-rw-r--r--gdb/remote-rdi.c2
-rw-r--r--gdb/solib.c4
-rw-r--r--gdb/source.c2
-rw-r--r--gdb/symfile.c6
-rw-r--r--gdb/top.c2
-rw-r--r--gdb/tracepoint.c4
-rw-r--r--gdb/win32-nat.c2
-rw-r--r--gdb/windows-nat.c2
20 files changed, 80 insertions, 45 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5396555..96ad241 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,25 @@
+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.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 640505e..f137075 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7381,19 +7381,19 @@ expression to be evaluated whenever breakpoint N is reached. ");
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\
@@ -7507,7 +7507,7 @@ This is useful for breaking on return to a stack frame.\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);
@@ -7638,19 +7638,19 @@ by using \"enable delete\" on the catchpoint number.");
"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''.");
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 16cc989..8458440 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -673,7 +673,7 @@ The commands below can be used to select other frames by number or address.",
"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\
@@ -698,11 +698,11 @@ Commands defined in this way may have up to ten arguments.");
"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);
@@ -804,7 +804,7 @@ from the target.", &setlist),
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
@@ -817,7 +817,7 @@ With no arguments, run an inferior shell.");
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\
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index a13b7b8..f68064e 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -86,6 +86,13 @@ cmd_cfunc_eq (struct cmd_list_element *cmd,
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
@@ -144,7 +151,7 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
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;
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index e4b7c55..51ca781 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -286,6 +286,9 @@ extern void set_cmd_sfunc (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,
diff --git a/gdb/command.h b/gdb/command.h
index 7c20a42..bebf6eb 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -292,6 +292,9 @@ extern void set_cmd_sfunc (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,
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 7acbd6eb..29eeac8 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -441,7 +441,7 @@ _initialize_core (void)
"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,
diff --git a/gdb/exec.c b/gdb/exec.c
index b07175e..0228f41 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -742,7 +742,7 @@ and it is the program executed when you use the `run' command.\n\
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,
@@ -750,7 +750,7 @@ No arg means to have no executable file and no symbols.", &cmdlist);
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\
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 157fb8a..c27d964 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -4709,7 +4709,7 @@ Do \"help breakpoints\" for info on other commands dealing with breakpoints.", 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,
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 0238448..f14811e 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1865,14 +1865,14 @@ _initialize_infcmd (void)
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);
@@ -1883,7 +1883,7 @@ Follow this command with any number of args, to be passed to the program.",
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",
@@ -1893,7 +1893,7 @@ environment to be given to the program.", &showlist);
"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\
@@ -1901,7 +1901,7 @@ Arguments are VAR VALUE where VAR is variable name and VALUE is value.\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\
@@ -1909,7 +1909,7 @@ $cwd in the path means the current working directory.\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\
@@ -1918,7 +1918,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.",
&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\
@@ -1974,14 +1974,14 @@ Argument N means do this N times (or till program stops for another reason).");
"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)
{
@@ -1992,7 +1992,7 @@ address.\n\
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)
@@ -2013,7 +2013,7 @@ Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
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,
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 0315227..fd51c2b 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2436,7 +2436,7 @@ with this command or \"print\".", NULL));
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);
@@ -2519,7 +2519,7 @@ You can see these environment settings with the \"show\" command.", NULL));
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\
@@ -2552,13 +2552,13 @@ resides in memory.\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,
diff --git a/gdb/proc-api.c b/gdb/proc-api.c
index 986691d..2d3ca9f 100644
--- a/gdb/proc-api.c
+++ b/gdb/proc-api.c
@@ -778,7 +778,7 @@ _initialize_proc_api (void)
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,
diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c
index db51dcb..dbf6cdf 100644
--- a/gdb/remote-rdi.c
+++ b/gdb/remote-rdi.c
@@ -1044,7 +1044,7 @@ With a single argument, sets the logfile name to that value.\n\
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,
diff --git a/gdb/solib.c b/gdb/solib.c
index c47c438..0c7eaba 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -872,7 +872,7 @@ inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
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,
@@ -880,5 +880,5 @@ For other (relative) files, you can add values using `set 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);
}
diff --git a/gdb/source.c b/gdb/source.c
index ee4998d..6a9bd5c 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1586,7 +1586,7 @@ With no argument, reset the search path to $cdir:$cwd, the default.",
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\
diff --git a/gdb/symfile.c b/gdb/symfile.c
index feca03b..568b821 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3214,7 +3214,7 @@ _initialize_symfile (void)
"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\
@@ -3224,7 +3224,7 @@ The optional arguments are section-name section-address pairs and\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,
@@ -3236,7 +3236,7 @@ with the text. SECT is a section name to be loaded at SECT_ADDR.",
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,
diff --git a/gdb/top.c b/gdb/top.c
index 972a557..16d590f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2008,7 +2008,7 @@ ie. the number of previous commands to keep a record of.", &sethistlist);
(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
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 860b483..5809acc 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2677,7 +2677,7 @@ last tracepoint 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.");
@@ -2800,7 +2800,7 @@ Argument may be a line number, function name, or '*' plus an address.\n\
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);
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index ddbcd0b..daca498 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -1819,7 +1819,7 @@ _initialize_inftarg (void)
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)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index ddbcd0b..daca498 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1819,7 +1819,7 @@ _initialize_inftarg (void)
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)