2003-11-13 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Thu, 13 Nov 2003 19:06:26 +0000 (19:06 +0000)
committerAndrew Cagney <cagney@redhat.com>
Thu, 13 Nov 2003 19:06:26 +0000 (19:06 +0000)
* arch-utils.h (selected_architecture_name): Declare.
(selected_byte_order): Declare.
* arch-utils.c (selected_byte_order): New function.
(selected_architecture_name): New function.
(target_architecture_auto): Make static.
(set_architecture_string): Make static.
(target_byte_order): Make static.
(target_byte_order_auto): Make static.
* gdbarch.sh (TARGET_BYTE_ORDER, TARGET_ARCHITECTURE): Delete
non-multi-arch definition.
(TARGET_ARCHITECTURE_AUTO, TARGET_BYTE_ORDER_AUTO): Delete.
(target_byte_order, target_architecture): Delete declaration.
(target_byte_order_auto, target_architecture_auto): Ditto.
* gdbarch.h: Re-generate.
* remote-sim.c (gdbsim_open): Use "selected_architecture_name" and
"selected_byte_order".

gdb/ChangeLog
gdb/arch-utils.c
gdb/arch-utils.h
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/remote-sim.c

index 512e6fab10d61f6231e3e94ffc081ca0233227ba..5097bec2d27fd968d1a8cfda452e76d392906135 100644 (file)
@@ -1,3 +1,22 @@
+2003-11-13  Andrew Cagney  <cagney@redhat.com>
+
+       * arch-utils.h (selected_architecture_name): Declare.
+       (selected_byte_order): Declare.
+       * arch-utils.c (selected_byte_order): New function.
+       (selected_architecture_name): New function.
+       (target_architecture_auto): Make static.
+       (set_architecture_string): Make static.
+       (target_byte_order): Make static.
+       (target_byte_order_auto): Make static.
+       * gdbarch.sh (TARGET_BYTE_ORDER, TARGET_ARCHITECTURE): Delete
+       non-multi-arch definition.
+       (TARGET_ARCHITECTURE_AUTO, TARGET_BYTE_ORDER_AUTO): Delete.
+       (target_byte_order, target_architecture): Delete declaration.
+       (target_byte_order_auto, target_architecture_auto): Ditto.
+       * gdbarch.h: Re-generate.
+       * remote-sim.c (gdbsim_open): Use "selected_architecture_name" and
+       "selected_byte_order".
+       
 2003-11-13  Andrew Cagney  <cagney@redhat.com>
 
        * ppc-linux-tdep.c (ppc_linux_return_value): Fix parameter order.
index 8d5720c6295fc795217c6172f1281a20fcdbdccd..4234cb6dd639eb1304619bda1b147bb356c5384e 100644 (file)
@@ -380,8 +380,17 @@ default_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
    The choice of initial value is entirely arbitrary.  During startup,
    the function initialize_current_architecture() updates this value
    based on default byte-order information extracted from BFD.  */
-int target_byte_order = BFD_ENDIAN_BIG;
-int target_byte_order_auto = 1;
+static int target_byte_order = BFD_ENDIAN_BIG;
+static int target_byte_order_auto = 1;
+
+enum bfd_endian
+selected_byte_order (void)
+{
+  if (target_byte_order_auto)
+    return BFD_ENDIAN_UNKNOWN;
+  else
+    return target_byte_order;
+}
 
 static const char endian_big[] = "big";
 static const char endian_little[] = "little";
@@ -400,7 +409,7 @@ static const char *set_endian_string;
 static void
 show_endian (char *args, int from_tty)
 {
-  if (TARGET_BYTE_ORDER_AUTO)
+  if (target_byte_order_auto)
     printf_unfiltered ("The target endianness is set automatically (currently %s endian)\n",
                       (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "big" : "little"));
   else
@@ -443,9 +452,18 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
 
 enum set_arch { set_arch_auto, set_arch_manual };
 
-int target_architecture_auto = 1;
+static int target_architecture_auto = 1;
+
+static const char *set_architecture_string;
 
-const char *set_architecture_string;
+const char *
+selected_architecture_name (void)
+{
+  if (target_architecture_auto)
+    return NULL;
+  else
+    return set_architecture_string;
+}
 
 /* Called if the user enters ``show architecture'' without an
    argument. */
index fbc7aa26949d91021dc8d1775761e2ee76ab233a..32fbc4d2ce3eed1d966ca301befe7f87f94bd6df 100644 (file)
@@ -149,9 +149,21 @@ extern int default_stabs_argument_has_addr (struct gdbarch *gdbarch,
 
 extern int legacy_register_sim_regno (int regnum);
 
+/* Return the selected byte order, or BFD_ENDIAN_UNKNOWN if no byte
+   order was explicitly selected.  */
+extern enum bfd_endian selected_byte_order (void);
+
+/* Return the selected architecture's name, or NULL if no architecture
+   was explicitly selected.  */
+extern const char *selected_architecture_name (void);
+
 /* Initialize a ``struct info''.  Can't use memset(0) since some
-   default values are not zero.  */
+   default values are not zero.  "fill" takes all available
+   information and fills in any unspecified fields.  */
+
 extern void gdbarch_info_init (struct gdbarch_info *info);
+extern void gdbarch_info_fill (struct gdbarch *gdbarch,
+                              struct gdbarch_info *info);
 
 /* Similar to init, but this time fill in the blanks.  Information is
    obtained from the specified architecture, global "set ..." options,
index 3affac564f0546f52f80089c15519ca1580986e6..69012592cd4d3f7a54a0beca06509e52b1cad840 100644 (file)
@@ -2609,6 +2609,7 @@ extern void set_gdbarch_data (struct gdbarch *gdbarch,
 extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
 
 
+
 /* Register per-architecture memory region.
 
    Provide a memory-region swap mechanism.  Per-architecture memory
@@ -2627,33 +2628,6 @@ extern void register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_
 
 
 
-/* The target-system-dependent byte order is dynamic */
-
-extern int target_byte_order;
-#ifndef TARGET_BYTE_ORDER
-#define TARGET_BYTE_ORDER (target_byte_order + 0)
-#endif
-
-extern int target_byte_order_auto;
-#ifndef TARGET_BYTE_ORDER_AUTO
-#define TARGET_BYTE_ORDER_AUTO (target_byte_order_auto + 0)
-#endif
-
-
-
-/* The target-system-dependent BFD architecture is dynamic */
-
-extern int target_architecture_auto;
-#ifndef TARGET_ARCHITECTURE_AUTO
-#define TARGET_ARCHITECTURE_AUTO (target_architecture_auto + 0)
-#endif
-
-extern const struct bfd_arch_info *target_architecture;
-#ifndef TARGET_ARCHITECTURE
-#define TARGET_ARCHITECTURE (target_architecture + 0)
-#endif
-
-
 /* Set the dynamic target-system-dependent parameters (architecture,
    byte-order, ...) using information found in the BFD */
 
index 95db7112098baeb4c153d991d2ee17d02b54a85f..29a2efae3ad92cf5d21f46a63bd958bfa046ee73 100755 (executable)
@@ -1215,6 +1215,7 @@ extern void set_gdbarch_data (struct gdbarch *gdbarch,
 extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
 
 
+
 /* Register per-architecture memory region.
 
    Provide a memory-region swap mechanism.  Per-architecture memory
@@ -1233,33 +1234,6 @@ extern void register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_
 
 
 
-/* The target-system-dependent byte order is dynamic */
-
-extern int target_byte_order;
-#ifndef TARGET_BYTE_ORDER
-#define TARGET_BYTE_ORDER (target_byte_order + 0)
-#endif
-
-extern int target_byte_order_auto;
-#ifndef TARGET_BYTE_ORDER_AUTO
-#define TARGET_BYTE_ORDER_AUTO (target_byte_order_auto + 0)
-#endif
-
-
-
-/* The target-system-dependent BFD architecture is dynamic */
-
-extern int target_architecture_auto;
-#ifndef TARGET_ARCHITECTURE_AUTO
-#define TARGET_ARCHITECTURE_AUTO (target_architecture_auto + 0)
-#endif
-
-extern const struct bfd_arch_info *target_architecture;
-#ifndef TARGET_ARCHITECTURE
-#define TARGET_ARCHITECTURE (target_architecture + 0)
-#endif
-
-
 /* Set the dynamic target-system-dependent parameters (architecture,
    byte-order, ...) using information found in the BFD */
 
index 538f8a4dbc16275583fa32cf088d4f5e5cfc1bf7..b1dc94e0cac658afff30ad1e884c29bb8e1be3fb 100644 (file)
@@ -42,6 +42,7 @@
 #include "regcache.h"
 #include "gdb_assert.h"
 #include "sim-regno.h"
+#include "arch-utils.h"
 
 /* Prototypes */
 
@@ -504,27 +505,23 @@ gdbsim_open (char *args, int from_tty)
   strcpy (arg_buf, "gdbsim");  /* 7 */
   /* Specify the byte order for the target when it is both selectable
      and explicitly specified by the user (not auto detected). */
-  if (!TARGET_BYTE_ORDER_AUTO)
+  switch (selected_byte_order ())
     {
-      switch (TARGET_BYTE_ORDER)
-       {
-       case BFD_ENDIAN_BIG:
-         strcat (arg_buf, " -E big");
-         break;
-       case BFD_ENDIAN_LITTLE:
-         strcat (arg_buf, " -E little");
-         break;
-       default:
-         internal_error (__FILE__, __LINE__,
-                         "Value of TARGET_BYTE_ORDER unknown");
-       }
+    case BFD_ENDIAN_BIG:
+      strcat (arg_buf, " -E big");
+      break;
+    case BFD_ENDIAN_LITTLE:
+      strcat (arg_buf, " -E little");
+      break;
+    case BFD_ENDIAN_UNKNOWN:
+      break;
     }
   /* Specify the architecture of the target when it has been
      explicitly specified */
-  if (!TARGET_ARCHITECTURE_AUTO)
+  if (selected_architecture_name () != NULL)
     {
       strcat (arg_buf, " --architecture=");
-      strcat (arg_buf, TARGET_ARCHITECTURE->printable_name);
+      strcat (arg_buf, selected_architecture_name ());
     }
   /* finally, any explicit args */
   if (args)