Allow backends to set the architecture using bfd_architecture enum
authorAndrew Cagney <cagney@redhat.com>
Wed, 3 Sep 1997 07:31:55 +0000 (07:31 +0000)
committerAndrew Cagney <cagney@redhat.com>
Wed, 3 Sep 1997 07:31:55 +0000 (07:31 +0000)
instead of some magic name.

gdb/ChangeLog
gdb/sh3-rom.c
gdb/top.c

index 04de252f71950bcb3d7f9dc2f1e3f8efee8256a9..86130314c052133b54f3459e13775b1751649abd 100644 (file)
@@ -1,3 +1,13 @@
+Wed Sep  3 16:39:39 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * top.c (set_arch): New function, update target_architecture.
+       
+       * defs.h, top.c (set_architecture_from_arch_mach): Replace
+       set_architecture, takes the arch and machine as arguments.
+
+       * sh3-rom.c (sh3e_open): Update.
+       (sh3_open): Ditto.
+
 Tue Sep  2 12:00:46 1997  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * remote-e7000.c (e7000_fetch_registers): Fix typo, stray paren.
index a4e3b7146aef0e6883ad3933244fc124ede2129f..8d8705c6d1ffc94f980ad6c979cc029e67dbebdc 100644 (file)
@@ -284,7 +284,7 @@ sh3_open (args, from_tty)
     }
 
   /* If we connected successfully, we know the processor is an SH3.  */
-  set_architecture ("sh3", 0);
+  set_architecture_from_arch_mach (bfd_arch_sh, bfd_mach_sh3);
 }
 
 
@@ -333,7 +333,7 @@ sh3e_open (args, from_tty)
     }
 
   /* If we connected successfully, we know the processor is an SH3E.  */
-  set_architecture ("sh3e", 0);
+  set_architecture_from_arch_mach (bfd_arch_sh, bfd_mach_sh3);
 }
 
 static void
index 80a2293c0226f4c4dbd7ec3ca1a5e9b307869573..cc1a1daca8bffdb37861402ee4183f3ce852d7cc 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -118,7 +118,7 @@ static void set_endian_auto PARAMS ((char *, int));
 
 static void show_endian PARAMS ((char *, int));
 
-extern void set_architecture PARAMS ((char *, int));
+static void set_architecture PARAMS ((char *, int));
 
 static void show_architecture PARAMS ((char *, int));
 
@@ -3242,8 +3242,27 @@ extern const bfd_arch_info_type bfd_default_arch_struct;
 const bfd_arch_info_type *target_architecture = &bfd_default_arch_struct;
 int (*target_architecture_hook) PARAMS ((const bfd_arch_info_type *ap));
 
-/* Called if the user enters ``set architecture'' with or without an argument. */
-void
+static void
+set_arch (arch)
+     const bfd_arch_info_type *arch;
+{
+  /* FIXME: Is it compatible with gdb? */
+  /* Check with the target on the setting */
+  if (target_architecture_hook != NULL
+      && !target_architecture_hook (arch))
+    printf_unfiltered ("Target does not support `%s' architecture.\n",
+                      arch->printable_name);
+  else
+    {
+      target_architecture_auto = 0;
+      target_architecture = arch;
+    }
+}
+
+
+/* Called if the user enters ``set architecture'' with or without an
+   argument. */
+static void
 set_architecture (args, from_tty)
      char *args;
      int from_tty;
@@ -3260,22 +3279,9 @@ set_architecture (args, from_tty)
     {
       const bfd_arch_info_type *arch = bfd_scan_arch (args);
       if (arch != NULL)
-       {
-         /* FIXME: Is it compatible with gdb? */
-         /* Check with the target on the setting */
-         if (target_architecture_hook != NULL
-             && !target_architecture_hook (arch))
-           printf_unfiltered ("Target does not support `%s' architecture.", args);
-         else
-           {
-             target_architecture_auto = 0;
-             target_architecture = arch;
-           }
-       }
+       set_arch (arch);
       else
-       {
-         printf_unfiltered ("Architecture `%s' not reconized.\n", args);
-       }
+       printf_unfiltered ("Architecture `%s' not reconized.\n", args);
     }
 }
 
@@ -3317,6 +3323,20 @@ info_architecture (args, from_tty)
     }
 }
 
+/* Set the architecture from arch/machine */
+void
+set_architecture_from_arch_mach (arch, mach)
+     enum bfd_architecture arch;
+     unsigned long mach;
+{
+  const bfd_arch_info_type *wanted = bfd_lookup_arch (arch, mach);
+  if (wanted != NULL)
+    set_arch (wanted);
+  else
+    fatal ("hardwired architecture/machine not reconized");
+}
+
+
 /* Set the architecture from a BFD */
 void
 set_architecture_from_file (abfd)
This page took 0.03073 seconds and 4 git commands to generate.