summaryrefslogtreecommitdiffstats
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-08-02 05:40:25 +0000
committerAndrew Cagney <cagney@redhat.com>2000-08-02 05:40:25 +0000
commit8e2481732f9f81db319019e749a74dab370c0f0c (patch)
treebfac9cdc90093cccff69d79f248452197a4496c1 /gdb
parent4e005f2e7fb326a6a5414d832aab826108f6d8ed (diff)
downloadppe42-binutils-8e2481732f9f81db319019e749a74dab370c0f0c.tar.gz
ppe42-binutils-8e2481732f9f81db319019e749a74dab370c0f0c.zip
Use add_set_auto_boolean_cmd() to implement ``set remote ?-packet''
command.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/TODO7
-rw-r--r--gdb/remote.c65
3 files changed, 26 insertions, 54 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d0adb91f13..1c1e9f7693 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+Wed Aug 2 14:46:18 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * remote.c (enum packet_detect, packet_support_enums,
+ packet_support_auto, packet_enable, packet_disable): Delete.
+ (show_packet_config_cmd, set_packet_config_cmd,
+ init_packet_config): Use add_set_auto_boolean_cmd.
+ * TODO: Update.
+
Wed Aug 2 13:06:25 2000 Andrew Cagney <cagney@b1.cygnus.com>
* remote-udi.c (udi_xfer_inferior_memory, udi_files_info,
diff --git a/gdb/TODO b/gdb/TODO
index 44be23918d..63ee0b4a2a 100644
--- a/gdb/TODO
+++ b/gdb/TODO
@@ -632,13 +632,6 @@ Get DEC/Compaq to contribute their Modula-3 support.
--
-set/show remote X-packet ...
-
-``(gdb) help set remote X-packet'' doesn't list the applicable
-responses. The help message needs to be expanded.
-
---
-
Remote protocol doco feedback.
Too much feedback to mention needs to be merged in (901660). Search
diff --git a/gdb/remote.c b/gdb/remote.c
index fff0ff7537..317954f548 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -518,52 +518,18 @@ enum packet_support
PACKET_DISABLE
};
-enum packet_detect
- {
- PACKET_AUTO_DETECT = 0,
- PACKET_MANUAL_DETECT
- };
-
struct packet_config
{
- const char *state;
char *name;
char *title;
- enum packet_detect detect;
+ enum cmd_auto_boolean detect;
enum packet_support support;
};
-static const char packet_support_auto[] = "auto";
-static const char packet_enable[] = "enable";
-static const char packet_disable[] = "disable";
-static const char *packet_support_enums[] =
-{
- packet_support_auto,
- packet_enable,
- packet_disable,
- 0,
-};
-
static void
set_packet_config_cmd (struct packet_config *config, struct cmd_list_element *c)
{
- if (config->state == packet_enable)
- {
- config->detect = PACKET_MANUAL_DETECT;
- config->support = PACKET_ENABLE;
- }
- else if (config->state == packet_disable)
- {
- config->detect = PACKET_MANUAL_DETECT;
- config->support = PACKET_DISABLE;
- }
- else if (config->state == packet_support_auto)
- {
- config->detect = PACKET_AUTO_DETECT;
- config->support = PACKET_SUPPORT_UNKNOWN;
- }
- else
- internal_error ("Bad enum value");
+ init_packet_config (config);
}
static void
@@ -584,13 +550,15 @@ show_packet_config_cmd (struct packet_config *config)
}
switch (config->detect)
{
- case PACKET_AUTO_DETECT:
+ case CMD_AUTO_BOOLEAN_AUTO:
printf_filtered ("Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.\n",
config->name, config->title, support);
break;
- case PACKET_MANUAL_DETECT:
- printf_filtered ("Support for remote protocol `%s' (%s) is currently %s.\n",
+ case CMD_AUTO_BOOLEAN_TRUE:
+ case CMD_AUTO_BOOLEAN_FALSE:
+ printf_filtered ("Support for remote protocol `%s' (%s) packet is currently %s.\n",
config->name, config->title, support);
+ break;
}
}
@@ -611,15 +579,15 @@ add_packet_config_cmd (config, name, title, set_func, show_func,
char *full_name;
config->name = name;
config->title = title;
+ config->detect = CMD_AUTO_BOOLEAN_AUTO;
+ config->support = PACKET_SUPPORT_UNKNOWN;
asprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet",
name, title);
asprintf (&show_doc, "Show current use of remote protocol `%s' (%s) packet",
name, title);
asprintf (&full_name, "%s-packet", name);
- c = add_set_enum_cmd (full_name,
- class_obscure, packet_support_enums,
- &config->state,
- set_doc, setlist);
+ c = add_set_auto_boolean_cmd (full_name, class_obscure,
+ &config->detect, set_doc, setlist);
c->function.sfunc = set_func;
add_cmd (full_name, class_obscure, show_func, show_doc, showlist);
}
@@ -629,11 +597,14 @@ init_packet_config (struct packet_config *config)
{
switch (config->detect)
{
- case PACKET_AUTO_DETECT:
- config->support = PACKET_SUPPORT_UNKNOWN;
+ case CMD_AUTO_BOOLEAN_TRUE:
+ config->support = PACKET_ENABLE;
break;
- case PACKET_MANUAL_DETECT:
- /* let the user beware */
+ case CMD_AUTO_BOOLEAN_FALSE:
+ config->support = PACKET_DISABLE;
+ break;
+ case CMD_AUTO_BOOLEAN_AUTO:
+ config->support = PACKET_SUPPORT_UNKNOWN;
break;
}
}
OpenPOWER on IntegriCloud