* Makefile.in (vax_tdep_h): Define.
authorJason Thorpe <thorpej@netbsd.org>
Wed, 26 Jun 2002 16:07:16 +0000 (16:07 +0000)
committerJason Thorpe <thorpej@netbsd.org>
Wed, 26 Jun 2002 16:07:16 +0000 (16:07 +0000)
(vax-tdep.o): Use $(vax_tdep_h).
* vax-tdep.c (vax_gdbarch_init): Use generic OS ABI framework.
(vax_dump_tdep): New function.
(_initialize_vax_tdep): Register vax_dump_tdep.
* vax-tdep.h: Include osabi.h.
(struct gdbarch_tdep): New.

gdb/ChangeLog
gdb/Makefile.in
gdb/vax-tdep.c
gdb/vax-tdep.h

index b6b0e18286b2bb62a0a6a8a26c58c2e5fdf86457..d61da7c91500172b30d1e984f19e410a0ec6660c 100644 (file)
@@ -1,3 +1,13 @@
+2002-06-26  Jason Thorpe  <thorpej@wasabisystems.com>
+
+       * Makefile.in (vax_tdep_h): Define.  
+       (vax-tdep.o): Use $(vax_tdep_h).
+       * vax-tdep.c (vax_gdbarch_init): Use generic OS ABI framework.
+       (vax_dump_tdep): New function. 
+       (_initialize_vax_tdep): Register vax_dump_tdep.
+       * vax-tdep.h: Include osabi.h.     
+       (struct gdbarch_tdep): New. 
+
 2002-06-26  Andrew Cagney  <cagney@redhat.com>
 
        * frame.h (deprecated_generic_find_dummy_frame): Rename
index 29e7060390c68841209927731568c5c8c0af4175..95b9723ffba997963a405a6b45cbff7213605360 100644 (file)
@@ -665,6 +665,7 @@ ui_out_h =      ui-out.h
 valprint_h =   valprint.h
 value_h =      value.h $(symtab_h) $(gdbtypes_h) $(expression_h) $(doublest_h)
 varobj_h =      varobj.h $(symtab_h) $(gdbtypes_h)
+vax_tdep_h =   vax-tdep.h osabi.h
 version_h =    version.h
 wrapper_h =    wrapper.h
 xcoffsolib_h = xcoffsolib.h
@@ -2236,7 +2237,7 @@ values.o: values.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \
        $(gdb_string_h) scm-lang.h $(doublest_h)
 
 vax-tdep.o: vax-tdep.c $(OP_INCLUDE)/vax.h $(defs_h) $(symtab_h) \
-       $(arch_utils_h) $(inferior_h) vax-tdep.h
+       $(arch_utils_h) $(inferior_h) $(vax_tdep_h)
 
 x86-64-linux-tdep.o : x86-64-linux-tdep.c $(defs_h) $(inferior_h) \
        $(gdbcore_h) $(regcache_h) x86-64-tdep.h i386-tdep.h $(dwarf2cfi_h)
index a723a6d0306fc02cad3306aeadc57984eae44127..40e4e96d5456d0451209d559035be63321c5a9dd 100644 (file)
@@ -620,13 +620,30 @@ print_insn_arg (char *d, register char *p, CORE_ADDR addr,
 static struct gdbarch *
 vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
+  struct gdbarch_tdep *tdep;
   struct gdbarch *gdbarch;
+  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
-  /* Right now there is only one VAX architecture variant.  */
-  if (arches != NULL)
-    return (arches->gdbarch);
+  /* Try to determine the ABI of the object we are loading.  */
 
-  gdbarch = gdbarch_alloc (&info, NULL);
+  if (info.abfd != NULL)
+    osabi = gdbarch_lookup_osabi (info.abfd);
+
+  /* Find a candidate among extant architectures.  */
+  for (arches = gdbarch_list_lookup_by_info (arches, &info);
+       arches != NULL;
+       arches = gdbarch_list_lookup_by_info (arches->next, &info))
+    {
+      /* Make sure the ABI selection matches.  */
+      tdep = gdbarch_tdep (arches->gdbarch);
+      if (tdep && tdep->osabi == osabi)
+       return arches->gdbarch;
+    }
+
+  tdep = xmalloc (sizeof (struct gdbarch_tdep));
+  gdbarch = gdbarch_alloc (&info, tdep);
+
+  tdep->osabi = osabi;
 
   /* Register info */
   set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS);
@@ -696,13 +713,28 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Misc info */
   set_gdbarch_function_start_offset (gdbarch, 2);
 
+  /* Hook in ABI-specific overrides, if they have been registered.  */
+  gdbarch_init_osabi (info, gdbarch, osabi);
+
   return (gdbarch);
 }
 
+static void
+vax_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+  if (tdep == NULL)
+    return;
+
+  fprintf_unfiltered (file, "vax_dump_tdep: OS ABI = %s\n",
+                     gdbarch_osabi_name (tdep->osabi));
+}
+
 void
 _initialize_vax_tdep (void)
 {
-  gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL);
+  gdbarch_register (bfd_arch_vax, vax_gdbarch_init, vax_dump_tdep);
 
   tm_print_insn = vax_print_insn;
 }
index 95324bcc036d2b2953e9e494402e74b93da8dce7..ccabdd53557697fcb10af835381bebc65b2ee100 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef VAX_TDEP_H
 #define VAX_TDEP_H
 
+#include "osabi.h"
+
 /* Say how long (ordinary) registers are.  This is a piece of bogosity
    used in push_word and a few other places;  REGISTER_RAW_SIZE is the
    real way to know how big a register is.  */
 #define VAX_PC_REGNUM     15  /* Contains program counter */
 #define VAX_PS_REGNUM     16  /* Contains processor status */
 
+/* Target-dependent structure in gdbarch.  */ 
+struct gdbarch_tdep
+{  
+  enum gdb_osabi osabi;                /* OS/ABI of inferior.  */
+};
+
 #endif /* VAX_TDEP_H */
This page took 0.032947 seconds and 4 git commands to generate.