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]

[commit] Deprecate add_set_cmd


Any set command should be accompanied by a corresponding show command (added using add-setshow-...) and hence allow the current value to be examined (otherwize the value is write only). These deprecated calls, which create commands such as:

(gdb) maintenance show-debug-registers <boolean>

do not. They should be replaced with something like:

(gdb) set|show maintenance show-debug-registers
or
(gdb) maintenance set|show show-debug-registers

committed,
Andrew
2005-02-21  Andrew Cagney  <cagney@gnu.org>

	* command.h (deprecated_add_set_cmd): Rename add_set_cmd.
	* cli/cli-decode.h (add_set_cmd): Delete declaration.
	* cli/cli-decode.c (deprecated_add_set_cmd): Rename add_set_cmd.
	* i386-nat.c (_initialize_i386_nat): Update call.
	* valprint.c (_initialize_valprint): Update comment.
	* gnu-nat.c (_initialize_gnu_nat): Update call.

Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.51
diff -p -u -r1.51 command.h
--- command.h	21 Feb 2005 07:15:47 -0000	1.51
+++ command.h	21 Feb 2005 17:12:38 -0000
@@ -205,11 +205,15 @@ extern void help_list (struct cmd_list_e
 extern void help_cmd_list (struct cmd_list_element *, enum command_class,
 			   char *, int, struct ui_file *);
 
-extern struct cmd_list_element *add_set_cmd (char *name, enum
-					     command_class class,
-					     var_types var_type, void *var,
-					     char *doc,
-					     struct cmd_list_element **list);
+/* NOTE: cagney/2005-02-21: Since every set command should be paired
+   with a corresponding show command (i.e., add_setshow_*) this call
+   should not be needed.  Unfortunatly some are not (e.g.,
+   "maintenance <variable> <value>") and those need to be fixed.  */
+extern struct cmd_list_element *deprecated_add_set_cmd (char *name, enum
+							command_class class,
+							var_types var_type, void *var,
+							char *doc,
+							struct cmd_list_element **list);
 
 /* Method for show a set/show variable's VALUE on FILE.  If this
    method isn't supplied deprecated_show_value_hack() is called (which
Index: gnu-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-nat.c,v
retrieving revision 1.36
diff -p -u -r1.36 gnu-nat.c
--- gnu-nat.c	15 Feb 2005 15:49:10 -0000	1.36
+++ gnu-nat.c	21 Feb 2005 17:12:39 -0000
@@ -3371,9 +3371,10 @@ _initialize_gnu_nat (void)
 
   add_task_commands ();
   add_thread_commands ();
-  add_set_cmd ("gnu-debug", class_maintenance,
-	       var_boolean, (char *) &gnu_debug_flag,
-	       "Set debugging output for the gnu backend.", &maintenancelist);
+  deprecated_add_set_cmd ("gnu-debug", class_maintenance,
+			  var_boolean, (char *) &gnu_debug_flag,
+			  "Set debugging output for the gnu backend.",
+			  &maintenancelist);
 }
 
 #ifdef	FLUSH_INFERIOR_CACHE
Index: i386-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nat.c,v
retrieving revision 1.10
diff -p -u -r1.10 i386-nat.c
--- i386-nat.c	11 Feb 2005 18:13:50 -0000	1.10
+++ i386-nat.c	21 Feb 2005 17:12:39 -0000
@@ -670,13 +670,13 @@ _initialize_i386_nat (void)
 #ifdef I386_USE_GENERIC_WATCHPOINTS
   /* A maintenance command to enable printing the internal DRi mirror
      variables.  */
-  add_set_cmd ("show-debug-regs", class_maintenance,
-	       var_boolean, (char *) &maint_show_dr,
-	       "\
+  deprecated_add_set_cmd ("show-debug-regs", class_maintenance,
+			  var_boolean, (char *) &maint_show_dr, _("\
 Set whether to show variables that mirror the x86 debug registers.\n\
 Use \"on\" to enable, \"off\" to disable.\n\
 If enabled, the debug registers values are shown when GDB inserts\n\
 or removes a hardware breakpoint or watchpoint, and when the inferior\n\
-triggers a breakpoint or watchpoint.", &maintenancelist);
+triggers a breakpoint or watchpoint."),
+			  &maintenancelist);
 #endif
 }
Index: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.49
diff -p -u -r1.49 valprint.c
--- valprint.c	18 Feb 2005 19:49:52 -0000	1.49
+++ valprint.c	21 Feb 2005 17:12:39 -0000
@@ -1274,8 +1274,10 @@ Show default output radix for printing o
   /* The "set radix" and "show radix" commands are special in that
      they are like normal set and show commands but allow two normally
      independent variables to be either set or shown with a single
-     command.  So the usual deprecated_add_set_cmd() and
+     command.  So the usual deprecated_add_set_cmd() and [deleted]
      add_show_from_set() commands aren't really appropriate. */
+  /* FIXME: i18n: With the new add_setshow_integer command, that is no
+     longer true - show can display anything.  */
   add_cmd ("radix", class_support, set_radix, _("\
 Set default input and output number radices.\n\
 Use 'set input-radix' or 'set output-radix' to independently set each.\n\
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.53
diff -p -u -r1.53 cli-decode.c
--- cli/cli-decode.c	21 Feb 2005 07:15:48 -0000	1.53
+++ cli/cli-decode.c	21 Feb 2005 17:12:39 -0000
@@ -368,12 +368,12 @@ add_setshow_cmd_full (char *name,
 }
 
 struct cmd_list_element *
-add_set_cmd (char *name,
-	     enum command_class class,
-	     var_types var_type,
-	     void *var,
-	     char *doc,
-	     struct cmd_list_element **list)
+deprecated_add_set_cmd (char *name,
+			enum command_class class,
+			var_types var_type,
+			void *var,
+			char *doc,
+			struct cmd_list_element **list)
 {
   return add_set_or_show_cmd (name, set_cmd, class, var_type, var, doc, list);
 }
Index: cli/cli-decode.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
retrieving revision 1.22
diff -p -u -r1.22 cli-decode.h
--- cli/cli-decode.h	21 Feb 2005 07:15:49 -0000	1.22
+++ cli/cli-decode.h	21 Feb 2005 17:12:39 -0000
@@ -286,12 +286,6 @@ extern void delete_cmd (char *, struct c
 extern void help_cmd_list (struct cmd_list_element *, enum command_class,
 			   char *, int, struct ui_file *);
 
-extern struct cmd_list_element *add_set_cmd (char *name, enum
-					     command_class class,
-					     var_types var_type, void *var,
-					     char *doc,
-					     struct cmd_list_element **list);
-
 /* Functions that implement commands about CLI commands. */
 
 extern void help_cmd (char *, struct ui_file *);

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