From 7f19b9a2d27295b92e12c1767a56afd54857be5f Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 15 Jun 2002 18:45:32 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 19 +++++++++++++++++++ gdb/cli/cli-decode.c | 2 +- gdb/cli/cli-decode.h | 2 +- gdb/cli/cli-setshow.c | 21 ++++++++++----------- gdb/command.h | 16 ++++------------ gdb/defs.h | 8 ++++++++ gdb/mips-tdep.c | 14 +++++++------- gdb/remote.c | 24 ++++++++++++------------ gdb/varobj.c | 22 +++++++++++++--------- 9 files changed, 75 insertions(+), 53 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 96dd2690c27..987c8856eea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,22 @@ +2002-06-15 Andrew Cagney + + * 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 * config/i386/tm-cygwin.h, config/i386/tm-fbsd.h, diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 3f510ac87d1..16be5e89a4e 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -371,7 +371,7 @@ add_set_enum_cmd (char *name, struct cmd_list_element * add_set_auto_boolean_cmd (char *name, enum command_class class, - enum cmd_auto_boolean *var, + enum auto_boolean *var, char *doc, struct cmd_list_element **list) { diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 72436f04657..5b6f9682e7c 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -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, enum command_class class, - enum cmd_auto_boolean *var, + enum auto_boolean *var, char *doc, struct cmd_list_element **list); diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index f967b0c3eba..94ba94e16dd 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -34,9 +34,8 @@ 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) { if (arg != NULL && *arg != '\0') @@ -48,18 +47,18 @@ parse_auto_binary_operation (const char *arg) || strncmp (arg, "1", length) == 0 || strncmp (arg, "yes", length) == 0 || strncmp (arg, "enable", length) == 0) - return CMD_AUTO_BOOLEAN_TRUE; + return AUTO_BOOLEAN_TRUE; else if (strncmp (arg, "off", length) == 0 || strncmp (arg, "0", length) == 0 || strncmp (arg, "no", length) == 0 || strncmp (arg, "disable", length) == 0) - return CMD_AUTO_BOOLEAN_FALSE; + return AUTO_BOOLEAN_FALSE; else if (strncmp (arg, "auto", length) == 0 || (strncmp (arg, "-1", length) == 0 && length > 1)) - return CMD_AUTO_BOOLEAN_AUTO; + return AUTO_BOOLEAN_AUTO; } error ("\"on\", \"off\" or \"auto\" expected."); - return CMD_AUTO_BOOLEAN_AUTO; /* pacify GCC */ + return AUTO_BOOLEAN_AUTO; /* pacify GCC */ } 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); break; 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; case var_uinteger: 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); break; 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); break; - case CMD_AUTO_BOOLEAN_FALSE: + case AUTO_BOOLEAN_FALSE: fputs_filtered ("off", stb->stream); break; - case CMD_AUTO_BOOLEAN_AUTO: + case AUTO_BOOLEAN_AUTO: fputs_filtered ("auto", stb->stream); break; default: diff --git a/gdb/command.h b/gdb/command.h index db7a7402584..e8694828a07 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -51,14 +51,6 @@ typedef enum 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. */ typedef enum var_types { @@ -67,9 +59,9 @@ typedef enum var_types var_boolean, /* "on" / "true" / "enable" or "off" / "false" / "disable" or - "auto. *VAR is an ``enum cmd_auto_boolean''. NOTE: In general - a custom show command will need to be implemented - one that - for "auto" prints both the "auto" and the current auto-selected + "auto. *VAR is an ``enum auto_boolean''. NOTE: In general a + custom show command will need to be implemented - one that for + "auto" prints both the "auto" and the current auto-selected value. */ 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, enum command_class class, - enum cmd_auto_boolean *var, + enum auto_boolean *var, char *doc, struct cmd_list_element **list); diff --git a/gdb/defs.h b/gdb/defs.h index ab66d731182..e7698b55860 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -222,6 +222,14 @@ enum precision_type 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 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 diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index d7f6d855ea0..85bac4f96a3 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -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? */ -enum cmd_auto_boolean mask_address_var = CMD_AUTO_BOOLEAN_AUTO; +enum auto_boolean mask_address_var = AUTO_BOOLEAN_AUTO; static int mips_mask_address_p (void) { switch (mask_address_var) { - case CMD_AUTO_BOOLEAN_TRUE: + case AUTO_BOOLEAN_TRUE: return 1; - case CMD_AUTO_BOOLEAN_FALSE: + case AUTO_BOOLEAN_FALSE: return 0; break; - case CMD_AUTO_BOOLEAN_AUTO: + case AUTO_BOOLEAN_AUTO: return MIPS_DEFAULT_MASK_ADDRESS_P; default: internal_error (__FILE__, __LINE__, @@ -495,13 +495,13 @@ show_mask_address (char *cmd, int from_tty) { switch (mask_address_var) { - case CMD_AUTO_BOOLEAN_TRUE: + case AUTO_BOOLEAN_TRUE: printf_filtered ("The 32 bit mips address mask is enabled\n"); break; - case CMD_AUTO_BOOLEAN_FALSE: + case AUTO_BOOLEAN_FALSE: printf_filtered ("The 32 bit mips address mask is disabled\n"); break; - case CMD_AUTO_BOOLEAN_AUTO: + case AUTO_BOOLEAN_AUTO: printf_filtered ("The 32 bit address mask is set automatically. Currently %s\n", mips_mask_address_p () ? "enabled" : "disabled"); break; diff --git a/gdb/remote.c b/gdb/remote.c index a1b90b7a5a4..9b3a4a82fac 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -583,7 +583,7 @@ struct packet_config { char *name; char *title; - enum cmd_auto_boolean detect; + enum auto_boolean detect; enum packet_support support; }; @@ -602,13 +602,13 @@ update_packet_config (struct packet_config *config) { switch (config->detect) { - case CMD_AUTO_BOOLEAN_TRUE: + case AUTO_BOOLEAN_TRUE: config->support = PACKET_ENABLE; break; - case CMD_AUTO_BOOLEAN_FALSE: + case AUTO_BOOLEAN_FALSE: config->support = PACKET_DISABLE; break; - case CMD_AUTO_BOOLEAN_AUTO: + case AUTO_BOOLEAN_AUTO: config->support = PACKET_SUPPORT_UNKNOWN; break; } @@ -632,12 +632,12 @@ show_packet_config_cmd (struct packet_config *config) } 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", config->name, config->title, support); break; - case CMD_AUTO_BOOLEAN_TRUE: - case CMD_AUTO_BOOLEAN_FALSE: + case AUTO_BOOLEAN_TRUE: + case AUTO_BOOLEAN_FALSE: printf_filtered ("Support for remote protocol `%s' (%s) packet is currently %s.\n", config->name, config->title, support); break; @@ -664,7 +664,7 @@ add_packet_config_cmd (struct packet_config *config, char *cmd_name; config->name = name; config->title = title; - config->detect = CMD_AUTO_BOOLEAN_AUTO; + config->detect = AUTO_BOOLEAN_AUTO; config->support = PACKET_SUPPORT_UNKNOWN; xasprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet", name, title); @@ -730,7 +730,7 @@ packet_ok (const char *buf, struct packet_config *config) switch (config->support) { 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 supported then there is a protocol error.. */ 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 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 set_remote_protocol_Z_packet_cmd (char *args, int from_tty, @@ -6150,7 +6150,7 @@ in a memory packet.\n", 0); /* Disable by default. The ``e'' packet has nasty interactions with 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); add_packet_config_cmd (&remote_protocol_E, @@ -6161,7 +6161,7 @@ in a memory packet.\n", 0); /* Disable by default. The ``e'' packet has nasty interactions with 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); add_packet_config_cmd (&remote_protocol_P, diff --git a/gdb/varobj.c b/gdb/varobj.c index 9ae145e2170..09b5a7cb888 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1210,7 +1210,7 @@ create_child (struct varobj *parent, int index, char *name) child->name = name; child->index = 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->parent = parent; child->root = parent->root; @@ -1645,8 +1645,8 @@ value_of_child (struct varobj *parent, int index) if (value != NULL && VALUE_LAZY (value)) { /* If we fail to fetch the value of the child, return - NULL so that callers notice that we're leaving an - error message. */ + NULL so that callers notice that we're leaving an + error message. */ if (!gdb_value_fetch_lazy (value)) value = NULL; } @@ -1929,7 +1929,8 @@ c_value_of_child (struct varobj *parent, int index) case TYPE_CODE_STRUCT: 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; case TYPE_CODE_PTR: @@ -1937,7 +1938,8 @@ c_value_of_child (struct varobj *parent, int index) { case TYPE_CODE_STRUCT: 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; default: @@ -2062,9 +2064,10 @@ c_value_of_variable (struct varobj *var) { if (VALUE_LAZY (var->value)) gdb_value_fetch_lazy (var->value); - val_print (VALUE_TYPE (var->value), VALUE_CONTENTS_RAW (var->value), 0, - VALUE_ADDRESS (var->value), - stb, format_code[(int) var->format], 1, 0, 0); + val_print (VALUE_TYPE (var->value), + VALUE_CONTENTS_RAW (var->value), 0, + VALUE_ADDRESS (var->value), stb, + format_code[(int) var->format], 1, 0, 0); thevalue = ui_file_xstrdup (stb, &dummy); do_cleanups (old_chain); } @@ -2200,7 +2203,8 @@ cplus_name_of_child (struct varobj *parent, int index) /* FIXME: This assumes that type orders inherited, public, private, protected */ 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]; if (STREQ (parent->name, "protected")) i += children[v_private]; -- 2.30.2