* defs.h (auto_boolean): Declare enum.

* command.h (cmd_auto_boolean): Delete enum.
* mips-tdep.c (mask_address_var): Update.
(mips_mask_address_p): Update.
(show_mask_address): Update.
* remote.c (struct packet_config): Update.
(update_packet_config): Update.
(show_packet_config_cmd): Update.
(packet_ok): Update.
(add_packet_config_cmd): Update.
(_initialize_remote):
* command.h: Update.
* cli/cli-setshow.c (parse_auto_binary_operation): Update.
(do_setshow_command): Update.
* cli/cli-decode.c (add_set_auto_boolean_cmd): Update.
* cli/cli-decode.h: Update.
This commit is contained in:
Andrew Cagney 2002-06-15 18:45:32 +00:00
parent 72797995ca
commit 7f19b9a2d2
9 changed files with 75 additions and 53 deletions

View file

@ -1,3 +1,22 @@
2002-06-15 Andrew Cagney <ac131313@redhat.com>
* defs.h (auto_boolean): Declare enum.
* command.h (cmd_auto_boolean): Delete enum.
* mips-tdep.c (mask_address_var): Update.
(mips_mask_address_p): Update.
(show_mask_address): Update.
* remote.c (struct packet_config): Update.
(update_packet_config): Update.
(show_packet_config_cmd): Update.
(packet_ok): Update.
(add_packet_config_cmd): Update.
(_initialize_remote):
* command.h: Update.
* cli/cli-setshow.c (parse_auto_binary_operation): Update.
(do_setshow_command): Update.
* cli/cli-decode.c (add_set_auto_boolean_cmd): Update.
* cli/cli-decode.h: Update.
2002-06-15 Mark Kettenis <kettenis@gnu.org> 2002-06-15 Mark Kettenis <kettenis@gnu.org>
* config/i386/tm-cygwin.h, config/i386/tm-fbsd.h, * config/i386/tm-cygwin.h, config/i386/tm-fbsd.h,

View file

@ -371,7 +371,7 @@ add_set_enum_cmd (char *name,
struct cmd_list_element * struct cmd_list_element *
add_set_auto_boolean_cmd (char *name, add_set_auto_boolean_cmd (char *name,
enum command_class class, enum command_class class,
enum cmd_auto_boolean *var, enum auto_boolean *var,
char *doc, char *doc,
struct cmd_list_element **list) struct cmd_list_element **list)
{ {

View file

@ -296,7 +296,7 @@ extern struct cmd_list_element *add_set_enum_cmd (char *name,
extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name, extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name,
enum command_class class, enum command_class class,
enum cmd_auto_boolean *var, enum auto_boolean *var,
char *doc, char *doc,
struct cmd_list_element **list); struct cmd_list_element **list);

View file

@ -34,9 +34,8 @@
static int parse_binary_operation (char *); static int parse_binary_operation (char *);
static enum cmd_auto_boolean parse_auto_binary_operation (const char *arg);
static enum cmd_auto_boolean static enum auto_boolean
parse_auto_binary_operation (const char *arg) parse_auto_binary_operation (const char *arg)
{ {
if (arg != NULL && *arg != '\0') if (arg != NULL && *arg != '\0')
@ -48,18 +47,18 @@ parse_auto_binary_operation (const char *arg)
|| strncmp (arg, "1", length) == 0 || strncmp (arg, "1", length) == 0
|| strncmp (arg, "yes", length) == 0 || strncmp (arg, "yes", length) == 0
|| strncmp (arg, "enable", length) == 0) || strncmp (arg, "enable", length) == 0)
return CMD_AUTO_BOOLEAN_TRUE; return AUTO_BOOLEAN_TRUE;
else if (strncmp (arg, "off", length) == 0 else if (strncmp (arg, "off", length) == 0
|| strncmp (arg, "0", length) == 0 || strncmp (arg, "0", length) == 0
|| strncmp (arg, "no", length) == 0 || strncmp (arg, "no", length) == 0
|| strncmp (arg, "disable", length) == 0) || strncmp (arg, "disable", length) == 0)
return CMD_AUTO_BOOLEAN_FALSE; return AUTO_BOOLEAN_FALSE;
else if (strncmp (arg, "auto", length) == 0 else if (strncmp (arg, "auto", length) == 0
|| (strncmp (arg, "-1", length) == 0 && length > 1)) || (strncmp (arg, "-1", length) == 0 && length > 1))
return CMD_AUTO_BOOLEAN_AUTO; return AUTO_BOOLEAN_AUTO;
} }
error ("\"on\", \"off\" or \"auto\" expected."); error ("\"on\", \"off\" or \"auto\" expected.");
return CMD_AUTO_BOOLEAN_AUTO; /* pacify GCC */ return AUTO_BOOLEAN_AUTO; /* pacify GCC */
} }
static int static int
@ -167,7 +166,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
*(int *) c->var = parse_binary_operation (arg); *(int *) c->var = parse_binary_operation (arg);
break; break;
case var_auto_boolean: case var_auto_boolean:
*(enum cmd_auto_boolean *) c->var = parse_auto_binary_operation (arg); *(enum auto_boolean *) c->var = parse_auto_binary_operation (arg);
break; break;
case var_uinteger: case var_uinteger:
if (arg == NULL) if (arg == NULL)
@ -296,15 +295,15 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
fputs_filtered (*(int *) c->var ? "on" : "off", stb->stream); fputs_filtered (*(int *) c->var ? "on" : "off", stb->stream);
break; break;
case var_auto_boolean: case var_auto_boolean:
switch (*(enum cmd_auto_boolean*) c->var) switch (*(enum auto_boolean*) c->var)
{ {
case CMD_AUTO_BOOLEAN_TRUE: case AUTO_BOOLEAN_TRUE:
fputs_filtered ("on", stb->stream); fputs_filtered ("on", stb->stream);
break; break;
case CMD_AUTO_BOOLEAN_FALSE: case AUTO_BOOLEAN_FALSE:
fputs_filtered ("off", stb->stream); fputs_filtered ("off", stb->stream);
break; break;
case CMD_AUTO_BOOLEAN_AUTO: case AUTO_BOOLEAN_AUTO:
fputs_filtered ("auto", stb->stream); fputs_filtered ("auto", stb->stream);
break; break;
default: default:

View file

@ -51,14 +51,6 @@ typedef enum cmd_types
} }
cmd_types; cmd_types;
/* Reasonable values for an AUTO_BOOLEAN variable. */
enum cmd_auto_boolean
{
CMD_AUTO_BOOLEAN_TRUE,
CMD_AUTO_BOOLEAN_FALSE,
CMD_AUTO_BOOLEAN_AUTO
};
/* Types of "set" or "show" command. */ /* Types of "set" or "show" command. */
typedef enum var_types typedef enum var_types
{ {
@ -67,9 +59,9 @@ typedef enum var_types
var_boolean, var_boolean,
/* "on" / "true" / "enable" or "off" / "false" / "disable" or /* "on" / "true" / "enable" or "off" / "false" / "disable" or
"auto. *VAR is an ``enum cmd_auto_boolean''. NOTE: In general "auto. *VAR is an ``enum auto_boolean''. NOTE: In general a
a custom show command will need to be implemented - one that custom show command will need to be implemented - one that for
for "auto" prints both the "auto" and the current auto-selected "auto" prints both the "auto" and the current auto-selected
value. */ value. */
var_auto_boolean, var_auto_boolean,
@ -231,7 +223,7 @@ extern struct cmd_list_element *add_set_enum_cmd (char *name,
extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name, extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name,
enum command_class class, enum command_class class,
enum cmd_auto_boolean *var, enum auto_boolean *var,
char *doc, char *doc,
struct cmd_list_element **list); struct cmd_list_element **list);

View file

@ -222,6 +222,14 @@ enum precision_type
unspecified_precision unspecified_precision
}; };
/* A generic, not quite boolean, enumeration. */
enum auto_boolean
{
AUTO_BOOLEAN_TRUE,
AUTO_BOOLEAN_FALSE,
AUTO_BOOLEAN_AUTO
};
/* the cleanup list records things that have to be undone /* the cleanup list records things that have to be undone
if an error happens (descriptors to be closed, memory to be freed, etc.) if an error happens (descriptors to be closed, memory to be freed, etc.)
Each link in the chain records a function to call and an Each link in the chain records a function to call and an

View file

@ -469,19 +469,19 @@ mips_register_convert_to_raw (struct type *virtual_type, int n,
} }
/* Should the upper word of 64-bit addresses be zeroed? */ /* Should the upper word of 64-bit addresses be zeroed? */
enum cmd_auto_boolean mask_address_var = CMD_AUTO_BOOLEAN_AUTO; enum auto_boolean mask_address_var = AUTO_BOOLEAN_AUTO;
static int static int
mips_mask_address_p (void) mips_mask_address_p (void)
{ {
switch (mask_address_var) switch (mask_address_var)
{ {
case CMD_AUTO_BOOLEAN_TRUE: case AUTO_BOOLEAN_TRUE:
return 1; return 1;
case CMD_AUTO_BOOLEAN_FALSE: case AUTO_BOOLEAN_FALSE:
return 0; return 0;
break; break;
case CMD_AUTO_BOOLEAN_AUTO: case AUTO_BOOLEAN_AUTO:
return MIPS_DEFAULT_MASK_ADDRESS_P; return MIPS_DEFAULT_MASK_ADDRESS_P;
default: default:
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
@ -495,13 +495,13 @@ show_mask_address (char *cmd, int from_tty)
{ {
switch (mask_address_var) switch (mask_address_var)
{ {
case CMD_AUTO_BOOLEAN_TRUE: case AUTO_BOOLEAN_TRUE:
printf_filtered ("The 32 bit mips address mask is enabled\n"); printf_filtered ("The 32 bit mips address mask is enabled\n");
break; break;
case CMD_AUTO_BOOLEAN_FALSE: case AUTO_BOOLEAN_FALSE:
printf_filtered ("The 32 bit mips address mask is disabled\n"); printf_filtered ("The 32 bit mips address mask is disabled\n");
break; break;
case CMD_AUTO_BOOLEAN_AUTO: case AUTO_BOOLEAN_AUTO:
printf_filtered ("The 32 bit address mask is set automatically. Currently %s\n", printf_filtered ("The 32 bit address mask is set automatically. Currently %s\n",
mips_mask_address_p () ? "enabled" : "disabled"); mips_mask_address_p () ? "enabled" : "disabled");
break; break;

View file

@ -583,7 +583,7 @@ struct packet_config
{ {
char *name; char *name;
char *title; char *title;
enum cmd_auto_boolean detect; enum auto_boolean detect;
enum packet_support support; enum packet_support support;
}; };
@ -602,13 +602,13 @@ update_packet_config (struct packet_config *config)
{ {
switch (config->detect) switch (config->detect)
{ {
case CMD_AUTO_BOOLEAN_TRUE: case AUTO_BOOLEAN_TRUE:
config->support = PACKET_ENABLE; config->support = PACKET_ENABLE;
break; break;
case CMD_AUTO_BOOLEAN_FALSE: case AUTO_BOOLEAN_FALSE:
config->support = PACKET_DISABLE; config->support = PACKET_DISABLE;
break; break;
case CMD_AUTO_BOOLEAN_AUTO: case AUTO_BOOLEAN_AUTO:
config->support = PACKET_SUPPORT_UNKNOWN; config->support = PACKET_SUPPORT_UNKNOWN;
break; break;
} }
@ -632,12 +632,12 @@ show_packet_config_cmd (struct packet_config *config)
} }
switch (config->detect) switch (config->detect)
{ {
case CMD_AUTO_BOOLEAN_AUTO: case AUTO_BOOLEAN_AUTO:
printf_filtered ("Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.\n", printf_filtered ("Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.\n",
config->name, config->title, support); config->name, config->title, support);
break; break;
case CMD_AUTO_BOOLEAN_TRUE: case AUTO_BOOLEAN_TRUE:
case CMD_AUTO_BOOLEAN_FALSE: case AUTO_BOOLEAN_FALSE:
printf_filtered ("Support for remote protocol `%s' (%s) packet is currently %s.\n", printf_filtered ("Support for remote protocol `%s' (%s) packet is currently %s.\n",
config->name, config->title, support); config->name, config->title, support);
break; break;
@ -664,7 +664,7 @@ add_packet_config_cmd (struct packet_config *config,
char *cmd_name; char *cmd_name;
config->name = name; config->name = name;
config->title = title; config->title = title;
config->detect = CMD_AUTO_BOOLEAN_AUTO; config->detect = AUTO_BOOLEAN_AUTO;
config->support = PACKET_SUPPORT_UNKNOWN; config->support = PACKET_SUPPORT_UNKNOWN;
xasprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet", xasprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet",
name, title); name, title);
@ -730,7 +730,7 @@ packet_ok (const char *buf, struct packet_config *config)
switch (config->support) switch (config->support)
{ {
case PACKET_ENABLE: case PACKET_ENABLE:
if (config->detect == CMD_AUTO_BOOLEAN_AUTO) if (config->detect == AUTO_BOOLEAN_AUTO)
/* If the stub previously indicated that the packet was /* If the stub previously indicated that the packet was
supported then there is a protocol error.. */ supported then there is a protocol error.. */
error ("Protocol error: %s (%s) conflicting enabled responses.", error ("Protocol error: %s (%s) conflicting enabled responses.",
@ -906,7 +906,7 @@ show_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty)
/* For compatibility with older distributions. Provide a ``set remote /* For compatibility with older distributions. Provide a ``set remote
Z-packet ...'' command that updates all the Z packet types. */ Z-packet ...'' command that updates all the Z packet types. */
static enum cmd_auto_boolean remote_Z_packet_detect; static enum auto_boolean remote_Z_packet_detect;
static void static void
set_remote_protocol_Z_packet_cmd (char *args, int from_tty, set_remote_protocol_Z_packet_cmd (char *args, int from_tty,
@ -6150,7 +6150,7 @@ in a memory packet.\n",
0); 0);
/* Disable by default. The ``e'' packet has nasty interactions with /* Disable by default. The ``e'' packet has nasty interactions with
the threading code - it relies on global state. */ the threading code - it relies on global state. */
remote_protocol_e.detect = CMD_AUTO_BOOLEAN_FALSE; remote_protocol_e.detect = AUTO_BOOLEAN_FALSE;
update_packet_config (&remote_protocol_e); update_packet_config (&remote_protocol_e);
add_packet_config_cmd (&remote_protocol_E, add_packet_config_cmd (&remote_protocol_E,
@ -6161,7 +6161,7 @@ in a memory packet.\n",
0); 0);
/* Disable by default. The ``e'' packet has nasty interactions with /* Disable by default. The ``e'' packet has nasty interactions with
the threading code - it relies on global state. */ the threading code - it relies on global state. */
remote_protocol_E.detect = CMD_AUTO_BOOLEAN_FALSE; remote_protocol_E.detect = AUTO_BOOLEAN_FALSE;
update_packet_config (&remote_protocol_E); update_packet_config (&remote_protocol_E);
add_packet_config_cmd (&remote_protocol_P, add_packet_config_cmd (&remote_protocol_P,

View file

@ -1210,7 +1210,7 @@ create_child (struct varobj *parent, int index, char *name)
child->name = name; child->name = name;
child->index = index; child->index = index;
child->value = value_of_child (parent, index); child->value = value_of_child (parent, index);
if ((!CPLUS_FAKE_CHILD(child) && child->value == NULL) || parent->error) if ((!CPLUS_FAKE_CHILD (child) && child->value == NULL) || parent->error)
child->error = 1; child->error = 1;
child->parent = parent; child->parent = parent;
child->root = parent->root; child->root = parent->root;
@ -1645,8 +1645,8 @@ value_of_child (struct varobj *parent, int index)
if (value != NULL && VALUE_LAZY (value)) if (value != NULL && VALUE_LAZY (value))
{ {
/* If we fail to fetch the value of the child, return /* If we fail to fetch the value of the child, return
NULL so that callers notice that we're leaving an NULL so that callers notice that we're leaving an
error message. */ error message. */
if (!gdb_value_fetch_lazy (value)) if (!gdb_value_fetch_lazy (value))
value = NULL; value = NULL;
} }
@ -1929,7 +1929,8 @@ c_value_of_child (struct varobj *parent, int index)
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION: case TYPE_CODE_UNION:
gdb_value_struct_elt (NULL, &value, &temp, NULL, name, NULL, "vstructure"); gdb_value_struct_elt (NULL, &value, &temp, NULL, name, NULL,
"vstructure");
break; break;
case TYPE_CODE_PTR: case TYPE_CODE_PTR:
@ -1937,7 +1938,8 @@ c_value_of_child (struct varobj *parent, int index)
{ {
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION: case TYPE_CODE_UNION:
gdb_value_struct_elt (NULL, &value, &temp, NULL, name, NULL, "vstructure"); gdb_value_struct_elt (NULL, &value, &temp, NULL, name, NULL,
"vstructure");
break; break;
default: default:
@ -2062,9 +2064,10 @@ c_value_of_variable (struct varobj *var)
{ {
if (VALUE_LAZY (var->value)) if (VALUE_LAZY (var->value))
gdb_value_fetch_lazy (var->value); gdb_value_fetch_lazy (var->value);
val_print (VALUE_TYPE (var->value), VALUE_CONTENTS_RAW (var->value), 0, val_print (VALUE_TYPE (var->value),
VALUE_ADDRESS (var->value), VALUE_CONTENTS_RAW (var->value), 0,
stb, format_code[(int) var->format], 1, 0, 0); VALUE_ADDRESS (var->value), stb,
format_code[(int) var->format], 1, 0, 0);
thevalue = ui_file_xstrdup (stb, &dummy); thevalue = ui_file_xstrdup (stb, &dummy);
do_cleanups (old_chain); do_cleanups (old_chain);
} }
@ -2200,7 +2203,8 @@ cplus_name_of_child (struct varobj *parent, int index)
/* FIXME: This assumes that type orders /* FIXME: This assumes that type orders
inherited, public, private, protected */ inherited, public, private, protected */
i = index + TYPE_N_BASECLASSES (type); i = index + TYPE_N_BASECLASSES (type);
if (STREQ (parent->name, "private") || STREQ (parent->name, "protected")) if (STREQ (parent->name, "private")
|| STREQ (parent->name, "protected"))
i += children[v_public]; i += children[v_public];
if (STREQ (parent->name, "protected")) if (STREQ (parent->name, "protected"))
i += children[v_private]; i += children[v_private];