This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] s/->completer/set_cmd_completer()/


Hello,

Another in the series of patches to tighten up access to the command 
object.  This one is mechanical but I'm not sure if I'll commit it now 
or in a week.

Andrew
2002-02-24  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.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.66
diff -u -r1.66 breakpoint.c
--- breakpoint.c	2002/02/18 13:35:29	1.66
+++ breakpoint.c	2002/02/24 21:07:06
@@ -7381,19 +7381,19 @@
 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 @@
 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 @@
 	       "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''.");
Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.24
diff -u -r1.24 command.h
--- command.h	2002/02/23 21:30:23	1.24
+++ command.h	2002/02/24 21:07:18
@@ -292,6 +292,9 @@
 			   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,
Index: corefile.c
===================================================================
RCS file: /cvs/src/src/gdb/corefile.c,v
retrieving revision 1.17
diff -u -r1.17 corefile.c
--- corefile.c	2002/02/05 04:37:21	1.17
+++ corefile.c	2002/02/24 21:07:18
@@ -441,7 +441,7 @@
 	       "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,
Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.17
diff -u -r1.17 exec.c
--- exec.c	2002/01/09 18:49:22	1.17
+++ exec.c	2002/02/24 21:07:22
@@ -742,7 +742,7 @@
 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 @@
 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\
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.22
diff -u -r1.22 hppa-tdep.c
--- hppa-tdep.c	2002/02/03 11:43:17	1.22
+++ hppa-tdep.c	2002/02/24 21:07:57
@@ -4709,7 +4709,7 @@
 			      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, 
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.41
diff -u -r1.41 infcmd.c
--- infcmd.c	2002/02/06 13:00:45	1.41
+++ infcmd.c	2002/02/24 21:08:02
@@ -1865,14 +1865,14 @@
 
   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 @@
 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 @@
 	       "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 @@
 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 @@
 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 @@
 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 @@
 	       "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 @@
 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 @@
 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,
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.36
diff -u -r1.36 printcmd.c
--- printcmd.c	2002/02/01 01:49:54	1.36
+++ printcmd.c	2002/02/24 21:08:21
@@ -2436,7 +2436,7 @@
 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 @@
 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 @@
 		   "\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,
Index: proc-api.c
===================================================================
RCS file: /cvs/src/src/gdb/proc-api.c,v
retrieving revision 1.11
diff -u -r1.11 proc-api.c
--- proc-api.c	2002/02/05 04:37:22	1.11
+++ proc-api.c	2002/02/24 21:08:22
@@ -778,7 +778,7 @@
 
   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, 
Index: remote-rdi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-rdi.c,v
retrieving revision 1.20
diff -u -r1.20 remote-rdi.c
--- remote-rdi.c	2002/02/13 16:24:59	1.20
+++ remote-rdi.c	2002/02/24 21:08:23
@@ -1044,7 +1044,7 @@
 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,
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.47
diff -u -r1.47 solib.c
--- solib.c	2002/01/08 18:55:26	1.47
+++ solib.c	2002/02/24 21:08:38
@@ -872,7 +872,7 @@
 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 @@
 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);
 }
Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.24
diff -u -r1.24 source.c
--- source.c	2002/01/17 22:15:17	1.24
+++ source.c	2002/02/24 21:12:55
@@ -1586,7 +1586,7 @@
   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\
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.53
diff -u -r1.53 symfile.c
--- symfile.c	2002/02/06 18:31:07	1.53
+++ symfile.c	2002/02/24 21:15:43
@@ -3214,7 +3214,7 @@
 	       "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 @@
 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 @@
   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,
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.57
diff -u -r1.57 top.c
--- top.c	2002/02/23 20:12:13	1.57
+++ top.c	2002/02/24 21:17:18
@@ -2008,7 +2008,7 @@
 		   (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
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.33
diff -u -r1.33 tracepoint.c
--- tracepoint.c	2002/02/23 20:12:13	1.33
+++ tracepoint.c	2002/02/24 21:19:26
@@ -2677,7 +2677,7 @@
   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 @@
 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);
Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.56
diff -u -r1.56 win32-nat.c
--- win32-nat.c	2002/02/22 17:04:25	1.56
+++ win32-nat.c	2002/02/24 21:19:29
@@ -1819,7 +1819,7 @@
 
   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)
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.16
diff -u -r1.16 cli-cmds.c
--- cli-cmds.c	2002/02/23 20:12:13	1.16
+++ cli-cmds.c	2002/02/24 21:19:30
@@ -673,7 +673,7 @@
 	       "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 @@
 	       "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 @@
   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 @@
 
   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\
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.14
diff -u -r1.14 cli-decode.c
--- cli-decode.c	2002/02/23 20:12:13	1.14
+++ cli-decode.c	2002/02/24 21:19:35
@@ -86,6 +86,13 @@
   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 @@
   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;
Index: cli/cli-decode.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
retrieving revision 1.8
diff -u -r1.8 cli-decode.h
--- cli-decode.h	2002/02/23 20:12:13	1.8
+++ cli-decode.h	2002/02/24 21:19:47
@@ -286,6 +286,9 @@
 			   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,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]