]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* cli/cli-decode.c (add_setshow_boolean_cmd): Replace
authorAndrew Cagney <cagney@redhat.com>
Sat, 15 Jun 2002 21:07:59 +0000 (21:07 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 15 Jun 2002 21:07:59 +0000 (21:07 +0000)
add_set_boolean_cmd.
(add_setshow_cmd): New function.
* command.h (add_setshow_boolean_cmd): Replace
add_set_boolean_cmd.
* remote-rdi.c (_initialize_remote_rdi): Update ``set rdiheartbeat''
and ``set rdiromatzero''.
* maint.c (_initialize_maint_cmds): Update commented out code.
* cli/cli-decode.h (add_set_boolean_cmd): Delete declaration.
* target.c (initialize_targets): Update `set
trust-readonly-sections'.
* remote.c (_initialize_remote): Update `set remotebreak'.

gdb/ChangeLog
gdb/cli/cli-decode.c
gdb/cli/cli-decode.h
gdb/command.h
gdb/maint.c
gdb/remote-rdi.c
gdb/remote.c
gdb/target.c

index 6d371f5f1301698bbaca3043addddaef9e5e61dc..0b5f826a4c28233d6e6c82940a7f48f24e19be8b 100644 (file)
@@ -1,3 +1,18 @@
+2002-06-15  Andrew Cagney  <ac131313@redhat.com>
+
+       * cli/cli-decode.c (add_setshow_boolean_cmd): Replace
+       add_set_boolean_cmd.
+       (add_setshow_cmd): New function.
+       * command.h (add_setshow_boolean_cmd): Replace
+       add_set_boolean_cmd.
+       * remote-rdi.c (_initialize_remote_rdi): Update ``set rdiheartbeat''
+       and ``set rdiromatzero''.
+       * maint.c (_initialize_maint_cmds): Update commented out code.
+       * cli/cli-decode.h (add_set_boolean_cmd): Delete declaration.
+       * target.c (initialize_targets): Update `set
+       trust-readonly-sections'.
+       * remote.c (_initialize_remote): Update `set remotebreak'.
+
 2002-06-15  Mark Kettenis  <kettenis@gnu.org>
 
        * config/i386/tm-i386.h (FUNCTION_START_OFFSET, INNER_THAN,
index 77e893fbdf32d732db761ce8ebcc9fb031b75c76..b552c531388229ad27f2c86ae8ed8934d83f84cc 100644 (file)
@@ -325,6 +325,35 @@ add_set_or_show_cmd (char *name,
   return c;
 }
 
+/* Add element named NAME to both the command SET_LIST and SHOW_LIST.
+   CLASS is as in add_cmd.  VAR_TYPE is the kind of thing we are
+   setting.  VAR is address of the variable being controlled by this
+   command.  SET_FUNC and SHOW_FUNC are the callback functions (if
+   non-NULL).  SET_DOC and SHOW_DOC are the documentation strings.  */
+
+static struct cmd_list_element *
+add_setshow_cmd (char *name,
+                enum command_class class,
+                var_types var_type, void *var,
+                char *set_doc, char *show_doc,
+                cmd_sfunc_ftype *set_func, cmd_sfunc_ftype *show_func,
+                struct cmd_list_element **set_list,
+                struct cmd_list_element **show_list)
+{
+  struct cmd_list_element *set;
+  struct cmd_list_element *show;
+  set = add_set_or_show_cmd (name, set_cmd, class, var_type, var,
+                            set_doc, set_list);
+  if (set_func != NULL)
+    set_cmd_sfunc (set, set_func);
+  show = add_set_or_show_cmd (name, show_cmd, class, var_type, var,
+                             show_doc, show_list);
+  if (show_func != NULL)
+    set_cmd_sfunc (show, show_func);
+  /* The caller often wants to modify set to include info like an
+     enumeration.  */
+  return set;
+}
 
 struct cmd_list_element *
 add_set_cmd (char *name,
@@ -379,23 +408,26 @@ add_set_auto_boolean_cmd (char *name,
   return c;
 }
 
-/* Add element named NAME to command list LIST (the list for set
-   or some sublist thereof).
-   CLASS is as in add_cmd.
-   VAR is address of the variable which will contain the value.
-   DOC is the documentation string.  */
-struct cmd_list_element *
-add_set_boolean_cmd (char *name,
-                    enum command_class class,
-                    int *var,
-                    char *doc,
-                    struct cmd_list_element **list)
+/* Add element named NAME to both the set and show command LISTs (the
+   list for set/show or some sublist thereof).  CLASS is as in
+   add_cmd.  VAR is address of the variable which will contain the
+   value.  SET_DOC and SHOW_DOR are the documentation strings.  */
+void
+add_setshow_boolean_cmd (char *name,
+                        enum command_class class,
+                        int *var, char *set_doc, char *show_doc,
+                        cmd_sfunc_ftype *set_func,
+                        cmd_sfunc_ftype *show_func,
+                        struct cmd_list_element **set_list,
+                        struct cmd_list_element **show_list)
 {
   static const char *boolean_enums[] = { "on", "off", NULL };
   struct cmd_list_element *c;
-  c = add_set_cmd (name, class, var_boolean, var, doc, list);
+  c = add_setshow_cmd (name, class, var_boolean, var,
+                      set_doc, show_doc,
+                      set_func, show_func,
+                      set_list, show_list);
   c->enums = boolean_enums;
-  return c;
 }
 
 /* Where SETCMD has already been added, add the corresponding show
index 4c440aff4071af80f195b1eb5291d2b48b717a55..c5d06d5cf61a19437b634646d3871eebd8b6e744 100644 (file)
@@ -299,12 +299,6 @@ extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name,
                                                          char *doc,
                                                          struct cmd_list_element **list);
 
-extern struct cmd_list_element *add_set_boolean_cmd (char *name,
-                                                    enum command_class class,
-                                                    int *var,
-                                                    char *doc,
-                                                    struct cmd_list_element **list);
-
 extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *,
                                                   struct cmd_list_element
                                                   **);
index afc84e467f75eb1f28aeea742f9a167a38879b3e..75462e5d64545b3a4c4d5ce33d6d498191ce9665 100644 (file)
@@ -229,11 +229,15 @@ extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name,
                                                          char *doc,
                                                          struct cmd_list_element **list);
 
-extern struct cmd_list_element *add_set_boolean_cmd (char *name,
-                                                    enum command_class class,
-                                                    int *var,
-                                                    char *doc,
-                                                    struct cmd_list_element **list);
+extern void add_setshow_boolean_cmd (char *name,
+                                    enum command_class class,
+                                    int *var,
+                                    char *set_doc,
+                                    char *show_doc,
+                                    cmd_sfunc_ftype *set_func,
+                                    cmd_sfunc_ftype *show_func,
+                                    struct cmd_list_element **set_list,
+                                    struct cmd_list_element **show_list);
 
 extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *,
                                                   struct cmd_list_element
index ddaa390b683b27e2f34090ca364cc33488333936..f09703f7729bec1b05d5de7171c6bf880dbe47d4 100644 (file)
@@ -783,16 +783,15 @@ passes without a response from the target, an error occurs.", &setlist),
 
 
 #ifdef NOTYET
-  /* FIXME: cagney/2001-09-24: A patch introducing a
-     add_set_boolean_cmd() is pending, the below should probably use
-     it.  A patch implementing profiling is pending, this just sets up
-     the framework.  */
-  tmpcmd = add_set_cmd ("profile", class_maintenance,
-                       var_boolean, &maintenance_profile_p,
-                       "Set internal profiling.\n\
-When enabled GDB is profiled.",
-                       &maintenance_set_cmdlist);
-  set_cmd_sfunc (tmpcmd, maintenance_set_profile_cmd);
-  add_show_from_set (tmpcmd, &maintenance_show_cmdlist);
+  /* FIXME: cagney/2002-06-15: A patch implementing profiling is
+     pending, this just sets up the framework.  */
+  tmpcmd = add_setshow_boolean_cmd ("profile", class_maintenance,
+                                   var_boolean, &maintenance_profile_p, "\
+Set internal profiling.\n\
+When enabled GDB is profiled.", "\
+Show internal profiling.\n",
+                                   maintenance_set_profile_cmd, NULL,
+                                   &maintenance_set_cmdlist,
+                                   &maintenance_show_cmdlist);
 #endif
 }
index 5243f9bd28f623ab66be7f9de3e194461838bf32..228e3d98c3755eb5fd6a76bd7ae5407049b50202 100644 (file)
@@ -1041,24 +1041,24 @@ _initialize_remote_rdi (void)
           "Withough an argument, it will display current state.\n",
           &maintenancelist);
 
-  add_show_from_set
-    (add_set_boolean_cmd
-     ("rdiromatzero", no_class, &rom_at_zero,
-      "Set target has ROM at addr 0.\n"
-      "A true value disables vector catching, false enables vector catching.\n"
-      "This is evaluated at the time the 'target rdi' command is executed\n",
-      &setlist),
-     &showlist);
-
-  add_show_from_set
-    (add_set_boolean_cmd
-     ("rdiheartbeat", no_class, &rdi_heartbeat,
-      "Set enable for ADP heartbeat packets.\n"
-      "I don't know why you would want this. If you enable them,\n"
-      "it will confuse ARM and EPI JTAG interface boxes as well\n"
-      "as the Angel Monitor.\n",
-      &setlist),
-     &showlist);
+  add_setshow_boolean_cmd
+    ("rdiromatzero", no_class, &rom_at_zero,
+     "Set target has ROM at addr 0.\n"
+     "A true value disables vector catching, false enables vector catching.\n"
+     "This is evaluated at the time the 'target rdi' command is executed\n",
+     "Show if target has ROM at addr 0.\n",
+     NULL, NULL,
+     &setlist, &showlist);
+
+  add_setshow_boolean_cmd
+    ("rdiheartbeat", no_class, &rdi_heartbeat,
+     "Set enable for ADP heartbeat packets.\n"
+     "I don't know why you would want this. If you enable them,\n"
+     "it will confuse ARM and EPI JTAG interface boxes as well\n"
+     "as the Angel Monitor.\n",
+     "Show enable for ADP heartbeat packets.\n",
+     NULL, NULL,
+     &setlist, &showlist);
 }
 
 /* A little dummy to make linking with the library succeed. */
index 9b3a4a82face5f09019f2c962957759c94355521..c6bfc66993bb6b28d73abc653e4bce889d2010c2 100644 (file)
@@ -6069,11 +6069,11 @@ response packet.  GDB supplies the initial `$' character, and the\n\
 terminating `#' character and checksum.",
           &maintenancelist);
 
-  add_show_from_set
-    (add_set_boolean_cmd ("remotebreak", no_class, &remote_break,
-                         "Set whether to send break if interrupted.\n",
-                         &setlist),
-     &showlist);
+  add_setshow_boolean_cmd ("remotebreak", no_class, &remote_break,
+                          "Set whether to send break if interrupted.\n",
+                          "Show whether to send break if interrupted.\n",
+                          NULL, NULL,
+                          &setlist, &showlist);
 
   /* Install commands for configuring memory read/write packets. */
 
index 2cd492809f45d954b709d7b2b24e5d15652ca1c0..69f034513e4ea394ba0d8053db5eaf6a9e40b37e 100644 (file)
@@ -2299,16 +2299,15 @@ initialize_targets (void)
 When non-zero, target debugging is enabled.", &setdebuglist),
      &showdebuglist);
 
-  add_show_from_set 
-    (add_set_boolean_cmd 
-     ("trust-readonly-sections", class_support, 
-      &trust_readonly, 
-      "Set mode for reading from readonly sections.\n\
+  add_setshow_boolean_cmd ("trust-readonly-sections", class_support, 
+                          &trust_readonly, "\
+Set mode for reading from readonly sections.\n\
 When this mode is on, memory reads from readonly sections (such as .text)\n\
 will be read from the object file instead of from the target.  This will\n\
-result in significant performance improvement for remote targets.",
-      &setlist),
-     &showlist);
+result in significant performance improvement for remote targets.", "\
+Set mode for reading from readonly sections.\n",
+                          NULL, NULL,
+                          &setlist, &showlist);
 
   add_com ("monitor", class_obscure, do_monitor_command,
           "Send a command to the remote monitor (remote targets only).");