Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.213 diff -c -r1.213 Makefile.in *** Makefile.in 25 Jun 2002 18:38:56 -0000 1.213 --- Makefile.in 26 Jun 2002 06:15:07 -0000 *************** *** 665,670 **** --- 665,671 ---- 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,2242 **** $(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 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) --- 2237,2243 ---- $(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) 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: vax-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/vax-tdep.c,v retrieving revision 1.14 diff -c -r1.14 vax-tdep.c *** vax-tdep.c 17 Jun 2002 23:32:33 -0000 1.14 --- vax-tdep.c 26 Jun 2002 06:15:08 -0000 *************** *** 620,632 **** static struct gdbarch * vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; ! /* Right now there is only one VAX architecture variant. */ ! if (arches != NULL) ! return (arches->gdbarch); ! gdbarch = gdbarch_alloc (&info, NULL); /* Register info */ set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS); --- 620,649 ---- 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; ! /* Try to determine the ABI of the object we are loading. */ ! 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,708 **** /* Misc info */ set_gdbarch_function_start_offset (gdbarch, 2); return (gdbarch); } void _initialize_vax_tdep (void) { ! gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL); tm_print_insn = vax_print_insn; } --- 713,740 ---- /* 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, vax_dump_tdep); tm_print_insn = vax_print_insn; } Index: vax-tdep.h =================================================================== RCS file: /cvs/src/src/gdb/vax-tdep.h,v retrieving revision 1.1 diff -c -r1.1 vax-tdep.h *** vax-tdep.h 23 Apr 2002 00:53:30 -0000 1.1 --- vax-tdep.h 26 Jun 2002 06:15:08 -0000 *************** *** 21,26 **** --- 21,28 ---- #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. */ *************** *** 51,55 **** --- 53,63 ---- #define VAX_SP_REGNUM 14 /* Contains address of top of stack */ #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 */