From f3796e26572d9c543bde60af67a4c43311098526 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 30 Sep 2001 16:16:16 +0000 Subject: [PATCH] * cli/cli-decode.c (add_set_boolean_cmd): Define. * cli/cli-decode.h (add_set_boolean_cmd): Declare. * command.h (add_set_boolean_cmd): Ditto. * remote.c (_initialize_remote): Use add_set_boolean_cmd for "set remotebreak" --- gdb/ChangeLog | 8 ++++++++ gdb/cli/cli-decode.c | 19 +++++++++++++++++++ gdb/cli/cli-decode.h | 6 ++++++ gdb/command.h | 6 ++++++ gdb/remote.c | 7 +++---- 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bc52b07..c6b61f6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2001-09-29 Andrew Cagney + * cli/cli-decode.c (add_set_boolean_cmd): Define. + * cli/cli-decode.h (add_set_boolean_cmd): Declare. + * command.h (add_set_boolean_cmd): Ditto. + * remote.c (_initialize_remote): Use add_set_boolean_cmd for "set + remotebreak" + +2001-09-29 Andrew Cagney + * gdbarch.sh (gdbarch_dump): Sort output. * gdbarch.c: Regenerate. diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index d2fea6e..bb9eb94 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -291,6 +291,25 @@ 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) +{ + 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->enums = boolean_enums; + return c; +} + /* Where SETCMD has already been added, add the corresponding show command to LIST and return a pointer to the added command (not necessarily the head of LIST). */ diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 79f39d2..d35685c 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -329,6 +329,12 @@ 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 **); diff --git a/gdb/command.h b/gdb/command.h index ac52821..20ebef2 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -340,6 +340,12 @@ 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 **); diff --git a/gdb/remote.c b/gdb/remote.c index ecf9afc..0555088 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5877,10 +5877,9 @@ terminating `#' character and checksum.", &maintenancelist); add_show_from_set - (add_set_cmd ("remotebreak", no_class, - var_boolean, (char *) &remote_break, - "Set whether to send break if interrupted.\n", - &setlist), + (add_set_boolean_cmd ("remotebreak", no_class, &remote_break, + "Set whether to send break if interrupted.\n", + &setlist), &showlist); /* Install commands for configuring memory read/write packets. */ -- 2.7.4