This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] enum cmd_auto_boolean -> defs.h:enum auto_boolean


Hello,

This patch follows up a problem MichaelS hit when doing some breakpoint tweaks (overlays?). The enum cmd_auto_boolean is generally useful so why not move it to defs.h.

The attached patch does that.

Committed.
Andrew

2002-06-15  Andrew Cagney  <ac131313@redhat.com>

	* cli/cli-decode.h: Update.
	* 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.

Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.29
diff -u -r1.29 command.h
--- command.h	24 Mar 2002 00:40:35 -0000	1.29
+++ command.h	15 Jun 2002 18:39:04 -0000
@@ -51,14 +51,6 @@
   }
 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 @@
     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_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);
 
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.88
diff -u -r1.88 defs.h
--- defs.h	18 Apr 2002 18:08:59 -0000	1.88
+++ defs.h	15 Jun 2002 18:39:04 -0000
@@ -222,6 +222,14 @@
     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
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.77
diff -u -r1.77 mips-tdep.c
--- mips-tdep.c	13 Jun 2002 19:16:25 -0000	1.77
+++ mips-tdep.c	15 Jun 2002 18:39:08 -0000
@@ -469,19 +469,19 @@
 }
 
 /* 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 @@
 {
   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;
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.84
diff -u -r1.84 remote.c
--- remote.c	19 May 2002 20:11:16 -0000	1.84
+++ remote.c	15 Jun 2002 18:39:12 -0000
@@ -583,7 +583,7 @@
   {
     char *name;
     char *title;
-    enum cmd_auto_boolean detect;
+    enum auto_boolean detect;
     enum packet_support support;
   };
 
@@ -602,13 +602,13 @@
 {
   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 @@
     }
   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 @@
   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 @@
       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 @@
 /* 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 @@
 			 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 @@
 			 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,
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.28
diff -u -r1.28 varobj.c
--- varobj.c	5 May 2002 01:15:13 -0000	1.28
+++ varobj.c	15 Jun 2002 18:39:14 -0000
@@ -1210,7 +1210,7 @@
   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 @@
   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 @@
 
 	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 @@
 	    {
 	    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 @@
 	  {
 	    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 @@
 	  /* 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];
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.20
diff -u -r1.20 cli-decode.c
--- cli/cli-decode.c	12 Apr 2002 22:44:18 -0000	1.20
+++ cli/cli-decode.c	15 Jun 2002 18:39:15 -0000
@@ -371,7 +371,7 @@
 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)
 {
Index: cli/cli-decode.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
retrieving revision 1.11
diff -u -r1.11 cli-decode.h
--- cli/cli-decode.h	24 Mar 2002 00:40:35 -0000	1.11
+++ cli/cli-decode.h	15 Jun 2002 18:39:15 -0000
@@ -296,7 +296,7 @@
 
 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);
 
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.7
diff -u -r1.7 cli-setshow.c
--- cli/cli-setshow.c	5 Feb 2002 04:37:23 -0000	1.7
+++ cli/cli-setshow.c	15 Jun 2002 18:39:15 -0000
@@ -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 @@
 	  || 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 @@
 	  *(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 @@
 	  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:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]