This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] Fix ``set remote X-packet <tab>''
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [patch] Fix ``set remote X-packet <tab>''
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Wed, 02 Aug 2000 15:37:23 +1000
FYI,
It is now implemented using add_set_auto_boolean_cmd() and as a side
effect the <tab> expands to a list of possible options.
Andrew
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.
Index: TODO
===================================================================
RCS file: /cvs/src/src/gdb/TODO,v
retrieving revision 1.42
diff -p -r1.42 TODO
*** TODO 2000/07/24 14:49:05 1.42
--- TODO 2000/08/02 05:33:21
*************** Get DEC/Compaq to contribute their Modul
*** 622,634 ****
--
- 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
--- 622,627 ----
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.16
diff -p -r1.16 remote.c
*** remote.c 2000/07/30 01:48:27 1.16
--- remote.c 2000/08/02 05:33:34
*************** enum packet_support
*** 518,569 ****
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 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");
}
static void
--- 518,535 ----
PACKET_DISABLE
};
struct packet_config
{
char *name;
char *title;
! enum cmd_auto_boolean detect;
enum packet_support support;
};
static void
set_packet_config_cmd (struct packet_config *config, struct cmd_list_element *c)
{
! init_packet_config (config);
}
static void
*************** show_packet_config_cmd (struct packet_co
*** 584,596 ****
}
switch (config->detect)
{
! case PACKET_AUTO_DETECT:
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",
config->name, config->title, support);
}
}
--- 550,564 ----
}
switch (config->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 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;
}
}
*************** add_packet_config_cmd (config, name, tit
*** 611,625 ****
char *full_name;
config->name = name;
config->title = title;
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->function.sfunc = set_func;
add_cmd (full_name, class_obscure, show_func, show_doc, showlist);
}
--- 579,593 ----
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_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);
}
*************** init_packet_config (struct packet_config
*** 629,639 ****
{
switch (config->detect)
{
! case PACKET_AUTO_DETECT:
! config->support = PACKET_SUPPORT_UNKNOWN;
break;
! case PACKET_MANUAL_DETECT:
! /* let the user beware */
break;
}
}
--- 597,610 ----
{
switch (config->detect)
{
! case CMD_AUTO_BOOLEAN_TRUE:
! config->support = PACKET_ENABLE;
break;
! case CMD_AUTO_BOOLEAN_FALSE:
! config->support = PACKET_DISABLE;
! break;
! case CMD_AUTO_BOOLEAN_AUTO:
! config->support = PACKET_SUPPORT_UNKNOWN;
break;
}
}