* v850-tdep.c: Begin multi-arch'ing v850.
authorCorinna Vinschen <corinna@vinschen.de>
Thu, 16 May 2002 07:35:21 +0000 (07:35 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Thu, 16 May 2002 07:35:21 +0000 (07:35 +0000)
(v850_target_architecture_hook): Remove function.
(v850_gdbarch_init): New function.  Add code previously in
v850_target_architecture_hook().
(_initialize_v850_tdep): Don't  set target_architecture_hook.
Call register_gdbarch_init() instead.

gdb/ChangeLog
gdb/v850-tdep.c

index dbeec7a24653b20033609b41ae8162909b64657f..447c1c83799cfc6763410dddd7e29b0b997103bf 100644 (file)
@@ -1,3 +1,12 @@
+2002-05-16  Corinna Vinschen  <vinschen@redhat.com>
+
+       * v850-tdep.c: Begin multi-arch'ing v850.
+       (v850_target_architecture_hook): Remove function.
+       (v850_gdbarch_init): New function.  Add code previously in
+       v850_target_architecture_hook().
+       (_initialize_v850_tdep): Don't  set target_architecture_hook.
+       Call register_gdbarch_init() instead.
+
 2002-05-16 Daniel Jacobowitz  <drow@mvista.com>
 
        * gdbtypes.h (struct cplus_struct_type): Remove args field.
index 534e956506628b0d18944602e79dacc09ec77cd4..2bc76f58b103e8fd03b3c0e4eb0a3252b2127652 100644 (file)
@@ -830,33 +830,44 @@ v850_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs,
   return 0;
 }
 
-/* Change the register names based on the current machine type. */
-
-static int
-v850_target_architecture_hook (const bfd_arch_info_type *ap)
+static struct gdbarch *
+v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
-  int i, j;
+  struct gdbarch_tdep *tdep = NULL;
+  struct gdbarch *gdbarch;
+  int i;
+
+  /* find a candidate among the list of pre-declared architectures. */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return (arches->gdbarch);
 
-  if (ap->arch != bfd_arch_v850)
+#if 0
+  tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
+#endif
+
+  if (info.bfd_arch_info->arch != bfd_arch_v850)
     return 0;
 
+  gdbarch = gdbarch_alloc (&info, 0);
+
+  /* Change the register names based on the current machine type. */
   for (i = 0; v850_processor_type_table[i].regnames != NULL; i++)
     {
-      if (v850_processor_type_table[i].mach == ap->mach)
-       {
-         v850_register_names = v850_processor_type_table[i].regnames;
-         tm_print_insn_info.mach = ap->mach;
-         return 1;
-       }
+      if (v850_processor_type_table[i].mach == info.bfd_arch_info->mach)
+        {
+          v850_register_names = v850_processor_type_table[i].regnames;
+          tm_print_insn_info.mach = info.bfd_arch_info->mach;
+          break;
+        }
     }
 
-  internal_error (__FILE__, __LINE__,
-                 "Architecture `%s' unrecognized", ap->printable_name);
+  return gdbarch;
 }
 
 void
 _initialize_v850_tdep (void)
 {
   tm_print_insn = print_insn_v850;
-  target_architecture_hook = v850_target_architecture_hook;
+  register_gdbarch_init (bfd_arch_v850, v850_gdbarch_init);
 }