This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: eliminate deprecated_add_set_cmd
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Thomas Schwinge <tschwinge at gnu dot org>, Joel Brobecker <brobecker at adacore dot com>, Eli Zaretskii <eliz at gnu dot org>, ams at gnu dot org
- Date: Wed, 7 Jan 2009 21:33:56 +0000
- Subject: Re: eliminate deprecated_add_set_cmd
- References: <200812310114.45103.pedro@codesourcery.com> <20090104173520.GC26067@fencepost.gnu.org> <200901051931.30871.pedro@codesourcery.com>
Here goes, new patch adjusting the commands to your feedback. I've also
confirmed that this builds and works correctly on gnu/Hurd.
Eli, are the doco bits OK? The old 'maint gnu-debug' wasn't
documented, so this adds a short blurb cloned from the
'set debug lin-lwp' docs.
--
Pedro Alves
2009-01-07 Pedro Alves <pedro@codesourcery.com>
* cli/cli-decode.c (deprecated_add_set_cmd): Delete.
* command.h (deprecated_add_set_cmd): Delete declaration.
* gnu-nat.c (_initialize_gnu_nat): Replace 'maint gnu-debug' with
'set debug gnu-nat' and 'show debug gnu-nat'.
* i386-nat.c (_initialize_i386_nat): Replace 'maint
show-debug-registers' with 'maint set show-debug-registers' and
'maint show show-debug-registers'.
2009-01-07 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo: Document set/show debug gnu-nat. Replace 'maint
show-debug-regs' docs by 'maint set show-debug-regs' and 'maint
show show-debug-regs' docs.
---
gdb/cli/cli-decode.c | 11 -----------
gdb/command.h | 10 ----------
gdb/doc/gdb.texinfo | 11 +++++++++--
gdb/gnu-nat.c | 13 +++++++++----
gdb/i386-nat.c | 12 ++++++++----
5 files changed, 26 insertions(+), 31 deletions(-)
Index: src/gdb/cli/cli-decode.c
===================================================================
--- src.orig/gdb/cli/cli-decode.c 2009-01-05 17:16:49.000000000 +0000
+++ src/gdb/cli/cli-decode.c 2009-01-06 15:41:25.000000000 +0000
@@ -407,17 +407,6 @@ add_setshow_cmd_full (char *name,
*show_result = show;
}
-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)
-{
- return add_set_or_show_cmd (name, set_cmd, class, var_type, var, doc, list);
-}
-
/* Add element named NAME to command list LIST (the list for set or
some sublist thereof). CLASS is as in add_cmd. ENUMLIST is a list
of strings which may follow NAME. VAR is address of the variable
Index: src/gdb/command.h
===================================================================
--- src.orig/gdb/command.h 2009-01-05 17:16:39.000000000 +0000
+++ src/gdb/command.h 2009-01-06 15:41:25.000000000 +0000
@@ -201,16 +201,6 @@ 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 *);
-/* 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
is not good). */
Index: src/gdb/gnu-nat.c
===================================================================
--- src.orig/gdb/gnu-nat.c 2009-01-05 17:16:41.000000000 +0000
+++ src/gdb/gnu-nat.c 2009-01-07 18:42:31.000000000 +0000
@@ -3405,10 +3405,15 @@ _initialize_gnu_nat (void)
add_task_commands ();
add_thread_commands ();
- deprecated_add_set_cmd ("gnu-debug", class_maintenance,
- var_boolean, (char *) &gnu_debug_flag,
- "Set debugging output for the gnu backend.",
- &maintenancelist);
+ add_setshow_boolean_cmd ("gnu-nat", class_maintenance,
+ &gnu_debug_flag,
+ _("Set debugging output for the gnu backend."),
+ _("Show debugging output for the gnu backend."),
+ NULL,
+ NULL,
+ NULL,
+ &setdebuglist,
+ &showdebuglist);
}
#ifdef FLUSH_INFERIOR_CACHE
Index: src/gdb/i386-nat.c
===================================================================
--- src.orig/gdb/i386-nat.c 2009-01-05 17:16:42.000000000 +0000
+++ src/gdb/i386-nat.c 2009-01-07 00:47:47.000000000 +0000
@@ -709,13 +709,17 @@ _initialize_i386_nat (void)
#ifdef I386_USE_GENERIC_WATCHPOINTS
/* A maintenance command to enable printing the internal DRi mirror
variables. */
- 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\
+ add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
+ &maint_show_dr, _("\
+Set whether to show variables that mirror the x86 debug registers."), _("\
+Show whether to show variables that mirror the x86 debug registers."), _("\
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);
+ NULL,
+ NULL,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
#endif
}
Index: src/gdb/doc/gdb.texinfo
===================================================================
--- src.orig/gdb/doc/gdb.texinfo 2009-01-07 00:41:17.000000000 +0000
+++ src/gdb/doc/gdb.texinfo 2009-01-07 00:45:33.000000000 +0000
@@ -17416,6 +17416,11 @@ default is off.
@item show debug frame
Displays the current state of displaying @value{GDBN} frame debugging
info.
+@item set debug gnu-nat
+@cindex @sc{gnu}/Hurd debug messages
+Turns on or off debugging messages from the @sc{gnu}/Hurd debug support.
+@item show debug gnu-nat
+Show the current state of @sc{gnu}/Hurd debugging messages.
@item set debug infrun
@cindex inferior debugging info
Turns on or off display of @value{GDBN} debugging info for running the inferior.
@@ -24980,9 +24985,11 @@ Control the remote asynchronous support
Remote asynchronous support will be disabled until you use
the @samp{maint set remote-async} command to enable it.
-@kindex maint show-debug-regs
+@kindex maint set show-debug-regs
+@kindex maint show show-debug-regs
@cindex x86 hardware debug registers
-@item maint show-debug-regs
+@item maint set show-debug-regs
+@itemx maint show show-debug-regs
Control whether to show variables that mirror the x86 hardware debug
registers. Use @code{ON} to enable, @code{OFF} to disable. If
enabled, the debug registers values are shown when @value{GDBN} inserts or