aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/Makefile.in3
-rw-r--r--gdb/vax-tdep.c42
-rw-r--r--gdb/vax-tdep.h8
4 files changed, 57 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b6b0e18..d61da7c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 29e7060..95b9723 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -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)
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index a723a6d..40e4e96 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -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;
}
diff --git a/gdb/vax-tdep.h b/gdb/vax-tdep.h
index 95324bc..ccabdd5 100644
--- a/gdb/vax-tdep.h
+++ b/gdb/vax-tdep.h
@@ -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. */
@@ -52,4 +54,10 @@
#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 */