RFC/gdbarch: Make OS ABI a real member of the gdbarch

Daniel Jacobowitz drow@mvista.com
Sat Jan 4 23:37:00 GMT 2003


On Fri, Jan 03, 2003 at 05:15:34PM -0500, Andrew Cagney wrote:
> >+#
> >+i:2:TARGET_OSABI:enum gdb_osabi:osabi::::GDB_OSABI_UNKNOWN
> 
> Yes, much better.
> 
> >+enum gdb_osabi
> >+{
> >+  GDB_OSABI_UNINITIALIZED = -1, /* For struct gdbarch_info.  */
> >+
> >+  GDB_OSABI_UNKNOWN = 0,	/* keep this zero */
> 
> I belive that both of these `= ...' can be dropped - since info.osabi is 
> explicitly initialized, no magic values are needed.  This is also more 
> consistent with it being a named enum.

Probably, but it's a little tricky; it's used to index an array, check
various bounds, etc.  I'm going to leave that be for now.

> Hmm, why was the enum to a new file?  Ah!  Ulgh, "gdbarch.h" needs the 
> definition :-/  Rather than create a new file, just move the enum to 
> "defs.h".  This is consistent with other, similar, enums solved the 
> problem.  It also stops me thinking that "osabi.h" should include 
> "osabi-list.h" (nb, s/_/-/) :-)

OK, that's much nicer.  Thanks.  Here's the updated version that I'm
checking in.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-01-04  Daniel Jacobowitz  <drow@mvista.com>

	* arch-utils.c (gdbarch_info_init): Set osabi to
	GDB_OSABI_UNINITIALIZED.
	* gdbarch.sh: Add osabi to struct gdbarch and to struct
	gdbarch_info.  Include "osabi.h" in gdbarch.c.  Check osabi
	in gdbarch_list_lookup_by_info and in gdbarch_update_p.
	* gdbarch.c: Regenerated.
	* gdbarch.h: Regenerated.
	* osabi.c (gdbarch_lookup_osabi): Return GDB_OSABI_UNINITIALIZED if
	there's no BFD.
	(gdbarch_init_osabi): Remove osabi argument; use info.osabi.
	* osabi.h (enum gdb_osabi): Move to defs.h.
	(gdbarch_init_osabi): Update prototype.
	* defs.h (enum gdb_osabi): Moved here.
	* Makefile.in: Update dependencies.

	* alpha-tdep.h: Don't include "osabi.h".
	(struct gdbarch_tdep): Remove osabi member.
	* alpha-tdep.c: Include "osabi.h".
	(alpha_gdbarch_init): Don't call gdbarch_lookup_osabi.  Don't
	iterate over arches.  Update call to gdbarch_init_osabi.
	(alpha_dump_tdep): Don't dump osabi.
	* alpha-linux-tdep.c: Include "osabi.h".
	* alpha-osf1-tdep.c: Include "osabi.h".
	* alphafbsd-tdep.c: Include "osabi.h".
	* alphanbsd-tdep.c: Include "osabi.h".

	* arm-tdep.h: Don't include "osabi.h".
	(struct gdbarch_tdep): Remove osabi member.
	* arm-tdep.c: Include "osabi.h".
	(arm_gdbarch_init): Don't call gdbarch_lookup_osabi.  Don't
	iterate over arches.  Update call to gdbarch_init_osabi.
	(arm_dump_tdep): Don't dump osabi.
	* arm-linux-tdep.c: Include "osabi.h".
	* armnbsd-tdep.c: Include "osabi.h".

	* hppa-tdep.c (hppa_gdbarch_init): Don't call gdbarch_lookup_osabi.
	Update call to gdbarch_init_osabi.

	* i386-tdep.h: Don't include "osabi.h".
	(struct gdbarch_tdep): Remove osabi member.
	* i386-tdep.c: Include "osabi.h".
	(i386_gdbarch_init): Don't call gdbarch_lookup_osabi.  Don't
	iterate over arches.  Update call to gdbarch_init_osabi.
	(i386_dump_tdep): Don't dump osabi.
	* i386-linux-tdep.c: Include "osabi.h".
	* i386-sol2-tdep.c: Include "osabi.h".
	* i386bsd-tdep.c: Include "osabi.h".
	* i386gnu-tdep.c: Include "osabi.h".
	* i386ly-tdep.c: Include "osabi.h".
	* i386nbsd-tdep.c: Include "osabi.h".
	* i386obsd-tdep.c: Include "osabi.h".

	* mips-tdep.c (struct gdbarch_tdep): Remove osabi member.
	(mips_gdbarch_init): Don't call gdbarch_lookup_osabi.  Don't
	check osabi when iterating over arches.  Update call to
	gdbarch_init_osabi.
	(mips_dump_tdep): Don't dump osabi.

	* ns32k-tdep.h: Don't include "osabi.h".
	(struct gdbarch_tdep): Remove.
	* ns32k-tdep.c (ns32k_gdbarch_init): Don't call
	gdbarch_lookup_osabi.  Don't iterate over arches.  Don't
	allocate tdep.  Update call to gdbarch_init_osabi.
	(ns32k_dump_tdep): Remove.
	(_initialize_ns32k_tdep): Update call to gdbarch_register.
	* ns32knbsd-tdep.c: Include "osabi.h".

	* ppc-tdep.h: Don't include "osabi.h".
	(struct gdbarch_tdep): Remove osabi member.
	* rs6000-tdep.c: Include "osabi.h".
	(rs6000_gdbarch_init): Don't call gdbarch_lookup_osabi.  Don't check
	osabi when iterating over arches.  Update call to
	gdbarch_init_osabi.
	(rs6000_dump_tdep): Don't dump osabi.
	* ppc-linux-tdep.c: Include "osabi.h".
	* ppcnbsd-tdep.c: Include "osabi.h".

	* sh-tdep.h: Don't include "osabi.h".
	(struct gdbarch_tdep): Remove osabi member.
	* sh-tdep.c: Include "osabi.h".
	(sh_gdbarch_init): Don't call gdbarch_lookup_osabi.  Don't
	iterate over arches.  Update call to gdbarch_init_osabi.
	(sh_dump_tdep): Don't dump osabi.
	* shnbsd-tdep.c: Include "osabi.h".

	* sparc-tdep.c: Include "osabi.h".
	(sparc_gdbarch_init): Don't call gdbarch_lookup_osabi.  Don't
	iterate over arches.  Update call to gdbarch_init_osabi.
	(sparc_dump_tdep): Don't dump osabi.  Do dump the rest of the
	tdep structure.

	* vax-tdep.h: Don't include "osabi.h".
	(struct gdbarch_tdep): Remove.
	* vax-tdep.c: Include "osabi.h".
	(vax_gdbarch_init): Don't call gdbarch_lookup_osabi.  Don't
	iterate over arches.  Don't allocate tdep.  Update call
	to gdbarch_init_osabi.
	(vax_dump_tdep): Remove.
	(_initialize_vax_tdep): Update call to gdbarch_register.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.306
diff -u -p -r1.306 Makefile.in
--- Makefile.in	4 Jan 2003 22:37:46 -0000	1.306
+++ Makefile.in	4 Jan 2003 23:30:48 -0000
@@ -583,11 +583,11 @@ nm_h =		@nm_h@
 
 acconfig_h = acconfig.h
 ada_lang_h = ada-lang.h $(value_h) $(gdbtypes_h)
-alpha_tdep_h = alpha-tdep.h $(osabi_h)
+alpha_tdep_h = alpha-tdep.h
 alphabsd_tdep_h = alphabsd-tdep.h
 annotate_h = annotate.h $(symtab_h) $(gdbtypes_h)
 arch_utils_h = arch-utils.h
-arm_tdep_h = arm-tdep.h $(osabi_h)
+arm_tdep_h = arm-tdep.h
 ax_gdb_h = ax-gdb.h
 ax_h = ax.h $(doublest_h)
 bcache_h = bcache.h
@@ -641,7 +641,7 @@ gdbtypes_h = gdbtypes.h
 gnu_nat_h = gnu-nat.h
 gregset_h = gregset.h
 i386_linux_tdep_h = i386-linux-tdep.h
-i386_tdep_h = i386-tdep.h $(osabi_h)
+i386_tdep_h = i386-tdep.h
 i387_tdep_h = i387-tdep.h
 inf_loop_h = inf-loop.h
 inferior_h = inferior.h $(breakpoint_h) $(target_h) $(frame_h)
@@ -661,7 +661,7 @@ mips_tdep_h = mips-tdep.h
 mipsnbsd_tdep_h = mipsnbsd-tdep.h
 monitor_h = monitor.h
 nbsd_tdep_h = nbsd-tdep.h
-ns32k_tdep_h = ns32k-tdep.h $(osabi_h)
+ns32k_tdep_h = ns32k-tdep.h
 objc_lang_h = objc-lang.h
 objfiles_h = objfiles.h $(gdb_obstack_h) $(symfile_h)
 ocd_h = ocd.h
@@ -669,7 +669,7 @@ osabi_h = osabi.h
 p_lang_h = p-lang.h
 pa64solib_h = pa64solib.h
 parser_defs_h = parser-defs.h $(doublest_h)
-ppc_tdep_h = ppc-tdep.h $(osabi_h)
+ppc_tdep_h = ppc-tdep.h
 ppcnbsd_tdep_h = ppcnbsd-tdep.h
 proc_utils_h = proc-utils.h
 regcache_h = regcache.h
@@ -680,7 +680,7 @@ scm_lang_h = scm-lang.h $(scm_tags_h)
 scm_tags_h = scm-tags.h
 ser_unix_h = ser-unix.h
 serial_h = serial.h
-sh_tdep_h = sh-tdep.h $(osabi_h)
+sh_tdep_h = sh-tdep.h
 shnbsd_tdep_h = shnbsd-tdep.h
 sim_regno_h = sim-regno.h
 solib_svr4_h = solib-svr4.h
@@ -703,7 +703,7 @@ ui_out_h = ui-out.h
 valprint_h = valprint.h
 value_h = value.h $(doublest_h) $(symtab_h) $(gdbtypes_h) $(expression_h)
 varobj_h = varobj.h $(symtab_h) $(gdbtypes_h)
-vax_tdep_h = vax-tdep.h $(osabi_h)
+vax_tdep_h = vax-tdep.h
 version_h = version.h
 wince_stub_h = wince-stub.h
 wrapper_h = wrapper.h $(gdb_h)
@@ -1486,23 +1486,25 @@ aix-thread.o: aix-thread.c $(defs_h) $(g
 	$(target_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) $(language_h) \
 	$(ppc_tdep_h)
 alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
-	$(value_h) $(alpha_tdep_h)
+	$(value_h) $(alpha_tdep_h) $(osabi_h)
 alpha-nat.o: alpha-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
 	$(regcache_h) $(alpha_tdep_h) $(gregset_h) $(gdb_string_h)
 alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
-	$(value_h) $(alpha_tdep_h)
+	$(value_h) $(alpha_tdep_h) $(osabi_h)
 alpha-tdep.o: alpha-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
 	$(value_h) $(gdbcmd_h) $(gdbcore_h) $(dis_asm_h) $(symfile_h) \
 	$(objfiles_h) $(gdb_string_h) $(linespec_h) $(regcache_h) \
-	$(doublest_h) $(arch_utils_h) $(elf_bfd_h) $(alpha_tdep_h)
+	$(doublest_h) $(arch_utils_h) $(elf_bfd_h) $(alpha_tdep_h) \
+	$(osabi_h)
 alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(alpha_tdep_h) $(alphabsd_tdep_h) $(gregset_h)
 alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) $(alpha_tdep_h) \
 	$(alphabsd_tdep_h)
-alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h)
+alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h) \
+	$(osabi_h)
 alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
 	$(regcache_h) $(value_h) $(solib_svr4_h) $(alpha_tdep_h) \
-	$(alphabsd_tdep_h) $(nbsd_tdep_h)
+	$(alphabsd_tdep_h) $(nbsd_tdep_h) $(osabi_h)
 annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \
 	$(gdbtypes_h) $(breakpoint_h)
 arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(gdbcmd_h) \
@@ -1514,16 +1516,17 @@ arm-linux-nat.o: arm-linux-nat.c $(defs_
 	$(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h)
 arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
 	$(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \
-	$(doublest_h) $(arm_tdep_h) $(symtab_h) $(symfile_h) $(objfiles_h)
+	$(doublest_h) $(arm_tdep_h) $(symtab_h) $(symfile_h) $(objfiles_h) \
+	$(osabi_h)
 arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \
 	$(gdbcore_h) $(symfile_h) $(gdb_string_h) $(dis_asm_h) $(regcache_h) \
 	$(doublest_h) $(value_h) $(arch_utils_h) $(solib_svr4_h) \
 	$(arm_tdep_h) $(gdb_sim_arm_h) $(elf_bfd_h) $(coff_internal_h) \
-	$(elf_arm_h) $(gdb_assert_h) $(bfd_in2_h) $(libcoff_h)
+	$(elf_arm_h) $(gdb_assert_h) $(bfd_in2_h) $(libcoff_h) $(osabi_h)
 armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(arm_tdep_h) $(inferior_h) \
 	$(regcache_h) $(gdbcore_h)
 armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) $(arm_tdep_h) $(nbsd_tdep_h) \
-	$(solib_svr4_h)
+	$(solib_svr4_h) $(osabi_h)
 avr-tdep.o: avr-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \
 	$(symfile_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h)
 ax-gdb.o: ax-gdb.c $(defs_h) $(symtab_h) $(symfile_h) $(gdbtypes_h) \
@@ -1686,7 +1689,8 @@ gdbarch.o: gdbarch.c $(defs_h) $(arch_ut
 	$(gdb_string_h) $(symtab_h) $(frame_h) $(inferior_h) $(breakpoint_h) \
 	$(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(gdbthread_h) \
 	$(annotate_h) $(symfile_h) $(value_h) $(symcat_h) $(floatformat_h) \
-	$(gdb_assert_h) $(gdb_string_h) $(gdb_events_h) $(reggroups_h)
+	$(gdb_assert_h) $(gdb_string_h) $(gdb_events_h) $(reggroups_h) \
+	$(osabi_h)
 gdbtypes.o: gdbtypes.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \
 	$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(expression_h) \
 	$(language_h) $(target_h) $(value_h) $(demangle_h) $(complaints_h) \
@@ -1735,33 +1739,36 @@ i386-linux-nat.o: i386-linux-nat.c $(def
 	$(i387_tdep_h) $(i386_tdep_h) $(i386_linux_tdep_h)
 i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
 	$(value_h) $(regcache_h) $(inferior_h) $(symtab_h) $(symfile_h) \
-	$(objfiles_h) $(solib_svr4_h) $(i386_tdep_h) $(i386_linux_tdep_h)
+	$(objfiles_h) $(solib_svr4_h) $(i386_tdep_h) $(i386_linux_tdep_h) \
+	$(osabi_h)
 i386-nat.o: i386-nat.c $(defs_h) $(breakpoint_h) $(command_h) $(gdbcmd_h)
-i386-sol2-tdep.o: i386-sol2-tdep.c $(defs_h) $(value_h) $(i386_tdep_h)
+i386-sol2-tdep.o: i386-sol2-tdep.c $(defs_h) $(value_h) $(i386_tdep_h) \
+	$(osabi_h)
 i386-stub.o: i386-stub.c
 i386-tdep.o: i386-tdep.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
 	$(gdbcore_h) $(objfiles_h) $(target_h) $(floatformat_h) $(symfile_h) \
 	$(symtab_h) $(gdbcmd_h) $(command_h) $(arch_utils_h) $(regcache_h) \
 	$(doublest_h) $(value_h) $(gdb_assert_h) $(i386_tdep_h) \
-	$(i387_tdep_h)
+	$(i387_tdep_h) $(osabi_h)
 i386b-nat.o: i386b-nat.c $(defs_h)
 i386bsd-nat.o: i386bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
-	$(gdb_assert_h) $(gregset_h) $(i386_tdep_h) $(i387_tdep_h)
+	$(gdb_assert_h) $(gregset_h) $(i386_tdep_h) $(i387_tdep_h) \
+	$(osabi_h)
 i386bsd-tdep.o: i386bsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
 	$(gdbcore_h) $(regcache_h) $(gdb_string_h) $(i386_tdep_h)
 i386fbsd-nat.o: i386fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h)
 i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \
 	$(regcache_h) $(gdb_assert_h) $(i386_tdep_h) $(gnu_nat_h) \
 	$(i387_tdep_h)
-i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(i386_tdep_h)
+i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(i386_tdep_h) $(osabi_h)
 i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
-	$(regcache_h) $(target_h) $(i386_tdep_h)
+	$(regcache_h) $(target_h) $(i386_tdep_h) $(osabi_h)
 i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \
 	$(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \
-	$(nbsd_tdep_h) $(solib_svr4_h)
+	$(nbsd_tdep_h) $(solib_svr4_h) $(osabi_h)
 i386obsd-nat.o: i386obsd-nat.c $(defs_h)
 i386obsd-tdep.o: i386obsd-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \
-	$(regcache_h) $(i386_tdep_h) $(i387_tdep_h)
+	$(regcache_h) $(i386_tdep_h) $(i387_tdep_h) $(osabi_h)
 i386v-nat.o: i386v-nat.c $(defs_h) $(frame_h) $(inferior_h) $(language_h) \
 	$(gdbcore_h) $(gdb_stat_h) $(floatformat_h) $(target_h) $(i386_tdep_h)
 i386v4-nat.o: i386v4-nat.c $(defs_h) $(value_h) $(inferior_h) $(regcache_h) \
@@ -1936,10 +1943,11 @@ nlmread.o: nlmread.c $(defs_h) $(bfd_h) 
 	$(objfiles_h) $(buildsym_h) $(stabsread_h)
 ns32k-tdep.o: ns32k-tdep.c $(defs_h) $(frame_h) $(gdbtypes_h) $(gdbcore_h) \
 	$(inferior_h) $(regcache_h) $(target_h) $(arch_utils_h) \
-	$(ns32k_tdep_h) $(gdb_string_h)
+	$(ns32k_tdep_h) $(gdb_string_h) $(osabi_h)
 ns32knbsd-nat.o: ns32knbsd-nat.c $(defs_h) $(inferior_h) $(target_h) \
 	$(gdbcore_h) $(regcache_h)
-ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h) $(gdb_string_h)
+ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h) $(gdb_string_h) \
+	$(osabi_h)
 objc-lang.o: objc-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
 	$(parser_defs_h) $(language_h) $(c_lang_h) $(objc_lang_h) \
 	$(complaints_h) $(value_h) $(symfile_h) $(objfiles_h) \
@@ -1980,7 +1988,8 @@ ppc-linux-nat.o: ppc-linux-nat.c $(defs_
 	$(gdbcore_h) $(regcache_h) $(gregset_h) $(ppc_tdep_h) $(gdb_string_h)
 ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(frame_h) $(inferior_h) \
 	$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
-	$(objfiles_h) $(regcache_h) $(value_h) $(solib_svr4_h) $(ppc_tdep_h)
+	$(objfiles_h) $(regcache_h) $(value_h) $(solib_svr4_h) $(ppc_tdep_h) \
+	$(osabi_h)
 ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
 	$(regcache_h) $(value_h) $(gdb_string_h) $(ppc_tdep_h)
 ppcbug-rom.o: ppcbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
@@ -1989,7 +1998,7 @@ ppcnbsd-nat.o: ppcnbsd-nat.c $(defs_h) $
 	$(ppcnbsd_tdep_h)
 ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
 	$(target_h) $(breakpoint_h) $(value_h) $(ppc_tdep_h) \
-	$(ppcnbsd_tdep_h) $(nbsd_tdep_h) $(solib_svr4_h)
+	$(ppcnbsd_tdep_h) $(nbsd_tdep_h) $(solib_svr4_h) $(osabi_h)
 printcmd.o: printcmd.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_h) \
 	$(gdbtypes_h) $(value_h) $(language_h) $(expression_h) $(gdbcore_h) \
 	$(gdbcmd_h) $(target_h) $(breakpoint_h) $(demangle_h) $(valprint_h) \
@@ -2084,7 +2093,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
 	$(arch_utils_h) $(regcache_h) $(doublest_h) $(value_h) \
 	$(parser_defs_h) $(libbfd_h) $(coff_internal_h) $(libcoff_h) \
 	$(coff_xcoff_h) $(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) \
-	$(ppc_tdep_h)
+	$(ppc_tdep_h) $(osabi_h)
 s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h)
 s390-tdep.o: s390-tdep.c $(arch_utils_h) $(frame_h) $(inferior_h) \
 	$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
@@ -2112,13 +2121,13 @@ sh-tdep.o: sh-tdep.c $(defs_h) $(frame_h
 	$(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(value_h) $(dis_asm_h) \
 	$(inferior_h) $(gdb_string_h) $(arch_utils_h) $(floatformat_h) \
 	$(regcache_h) $(doublest_h) $(sh_tdep_h) $(elf_bfd_h) \
-	$(solib_svr4_h) $(elf_sh_h) $(gdb_sim_sh_h)
+	$(solib_svr4_h) $(elf_sh_h) $(gdb_sim_sh_h) $(osabi_h)
 sh3-rom.o: sh3-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 	$(serial_h) $(srec_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h) \
 	$(sh_tdep_h)
 shnbsd-nat.o: shnbsd-nat.c $(defs_h) $(inferior_h) $(shnbsd_tdep_h)
 shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) $(value_h) \
-	$(solib_svr4_h) $(nbsd_tdep_h) $(sh_tdep_h) $(shnbsd_tdep_h)
+	$(solib_svr4_h) $(nbsd_tdep_h) $(sh_tdep_h) $(shnbsd_tdep_h) $(osabi_h)
 sol-thread.o: sol-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
 	$(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(regcache_h) $(symfile_h) \
 	$(gregset_h)
@@ -2266,7 +2275,7 @@ varobj.o: varobj.c $(defs_h) $(value_h) 
 	$(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h)
 vax-tdep.o: vax-tdep.c $(defs_h) $(symtab_h) $(opcode_vax_h) $(gdbcore_h) \
 	$(inferior_h) $(regcache_h) $(frame_h) $(value_h) $(arch_utils_h) \
-	$(gdb_string_h) $(vax_tdep_h)
+	$(gdb_string_h) $(vax_tdep_h) $(osabi_h)
 w89k-rom.o: w89k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 	$(serial_h) $(xmodem_h) $(regcache_h)
 win32-nat.o: win32-nat.c $(defs_h) $(tm_h) $(frame_h) $(inferior_h) \
Index: alpha-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-linux-tdep.c,v
retrieving revision 1.7
diff -u -p -r1.7 alpha-linux-tdep.c
--- alpha-linux-tdep.c	21 Dec 2002 19:58:07 -0000	1.7
+++ alpha-linux-tdep.c	4 Jan 2003 23:30:48 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for GNU/Linux on Alpha.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,6 +22,7 @@
 #include "frame.h"
 #include "gdbcore.h"
 #include "value.h"
+#include "osabi.h"
 
 #include "alpha-tdep.h"
 
Index: alpha-osf1-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-osf1-tdep.c,v
retrieving revision 1.7
diff -u -p -r1.7 alpha-osf1-tdep.c
--- alpha-osf1-tdep.c	21 Dec 2002 19:58:07 -0000	1.7
+++ alpha-osf1-tdep.c	4 Jan 2003 23:30:48 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for OSF/1 on Alpha.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,6 +22,7 @@
 #include "frame.h"
 #include "gdbcore.h"
 #include "value.h"
+#include "osabi.h"
 
 #include "alpha-tdep.h"
 
Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.52
diff -u -p -r1.52 alpha-tdep.c
--- alpha-tdep.c	4 Jan 2003 22:37:46 -0000	1.52
+++ alpha-tdep.c	4 Jan 2003 23:30:48 -0000
@@ -34,6 +34,7 @@
 #include "regcache.h"
 #include "doublest.h"
 #include "arch-utils.h"
+#include "osabi.h"
 
 #include "elf-bfd.h"
 
@@ -1769,37 +1770,23 @@ alpha_gdbarch_init (struct gdbarch_info 
 {
   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)
+  if (info.abfd != NULL && info.osabi == GDB_OSABI_UNKNOWN)
     {
-      osabi = gdbarch_lookup_osabi (info.abfd);
-      if (osabi == GDB_OSABI_UNKNOWN)
-	{
-	  /* If it's an ECOFF file, assume it's OSF/1.  */
-	  if (bfd_get_flavour (info.abfd) == bfd_target_ecoff_flavour)
-	    osabi = GDB_OSABI_OSF1;
-	}
+      /* If it's an ECOFF file, assume it's OSF/1.  */
+      if (bfd_get_flavour (info.abfd) == bfd_target_ecoff_flavour)
+	osabi = GDB_OSABI_OSF1;
     }
 
   /* 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;
-    }
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
   tdep = xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
 
-  tdep->osabi = osabi;
-
   /* Lowest text address.  This is used by heuristic_proc_start() to
      decide when to stop looking.  */
   tdep->vm_min_address = (CORE_ADDR) 0x120000000;
@@ -1909,7 +1896,7 @@ alpha_gdbarch_init (struct gdbarch_info 
   set_gdbarch_frame_args_skip (gdbarch, 0);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   /* Now that we have tuned the configuration, set a few final things
      based on what the OS ABI has told us.  */
@@ -1927,9 +1914,6 @@ alpha_dump_tdep (struct gdbarch *current
 
   if (tdep == NULL)
     return;
-
-  fprintf_unfiltered (file, "alpha_dump_tdep: OS ABI = %s\n",
-		      gdbarch_osabi_name (tdep->osabi));
 
   fprintf_unfiltered (file,
                       "alpha_dump_tdep: vm_min_address = 0x%lx\n",
Index: alpha-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.h,v
retrieving revision 1.8
diff -u -p -r1.8 alpha-tdep.h
--- alpha-tdep.h	21 May 2002 15:36:02 -0000	1.8
+++ alpha-tdep.h	4 Jan 2003 23:30:48 -0000
@@ -1,5 +1,5 @@
 /* Common target dependent code for GDB on Alpha systems.
-   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002 Free
+   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003 Free
    Software Foundation, Inc.
 
    This file is part of GDB.
@@ -22,8 +22,6 @@
 #ifndef ALPHA_TDEP_H
 #define ALPHA_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.  */
@@ -81,8 +79,6 @@
 /* Target-dependent structure in gdbarch.  */
 struct gdbarch_tdep
 {
-  enum gdb_osabi osabi;		/* OS/ABI of inferior.  */
-
   CORE_ADDR vm_min_address;	/* used by heuristic_proc_start */
 
   /* If PC is inside a dynamically-generated signal trampoline function
Index: alphafbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alphafbsd-tdep.c,v
retrieving revision 1.6
diff -u -p -r1.6 alphafbsd-tdep.c
--- alphafbsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.6
+++ alphafbsd-tdep.c	4 Jan 2003 23:30:48 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for FreeBSD/Alpha.
-   Copyright 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -20,6 +20,7 @@
 
 #include "defs.h"
 #include "value.h"
+#include "osabi.h"
 
 #include "alpha-tdep.h"
 
Index: alphanbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alphanbsd-tdep.c,v
retrieving revision 1.11
diff -u -p -r1.11 alphanbsd-tdep.c
--- alphanbsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.11
+++ alphanbsd-tdep.c	4 Jan 2003 23:30:48 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for NetBSD/Alpha.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
    Contributed by Wasabi Systems, Inc.
 
    This file is part of GDB.
@@ -24,6 +24,7 @@
 #include "frame.h"
 #include "regcache.h"
 #include "value.h"
+#include "osabi.h"
 
 #include "solib-svr4.h"
 
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.73
diff -u -p -r1.73 arch-utils.c
--- arch-utils.c	9 Dec 2002 02:04:15 -0000	1.73
+++ arch-utils.c	4 Jan 2003 23:30:48 -0000
@@ -1,6 +1,6 @@
 /* Dynamic architecture support for GDB, the GNU debugger.
 
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
    Inc.
 
    This file is part of GDB.
@@ -911,6 +911,7 @@ gdbarch_info_init (struct gdbarch_info *
 {
   memset (info, 0, sizeof (struct gdbarch_info));
   info->byte_order = BFD_ENDIAN_UNKNOWN;
+  info->osabi = GDB_OSABI_UNINITIALIZED;
 }
 
 /* */
Index: arm-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-tdep.c,v
retrieving revision 1.24
diff -u -p -r1.24 arm-linux-tdep.c
--- arm-linux-tdep.c	21 Dec 2002 19:58:07 -0000	1.24
+++ arm-linux-tdep.c	4 Jan 2003 23:30:49 -0000
@@ -1,5 +1,5 @@
 /* GNU/Linux on ARM target support.
-   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -27,6 +27,7 @@
 #include "frame.h"
 #include "regcache.h"
 #include "doublest.h"
+#include "osabi.h"
 
 #include "arm-tdep.h"
 
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.87
diff -u -p -r1.87 arm-tdep.c
--- arm-tdep.c	4 Jan 2003 22:37:46 -0000	1.87
+++ arm-tdep.c	4 Jan 2003 23:30:49 -0000
@@ -34,6 +34,7 @@
 #include "value.h"
 #include "arch-utils.h"
 #include "solib-svr4.h"
+#include "osabi.h"
 
 #include "arm-tdep.h"
 #include "gdb/sim-arm.h"
@@ -2814,44 +2815,33 @@ arm_gdbarch_init (struct gdbarch_info in
 {
   struct gdbarch_tdep *tdep;
   struct gdbarch *gdbarch;
-  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
   /* Try to deterimine the ABI of the object we are loading.  */
 
-  if (info.abfd != NULL)
+  if (info.abfd != NULL && info.osabi == GDB_OSABI_UNKNOWN)
     {
-      osabi = gdbarch_lookup_osabi (info.abfd);
-      if (osabi == GDB_OSABI_UNKNOWN)
+      switch (bfd_get_flavour (info.abfd))
 	{
-	  switch (bfd_get_flavour (info.abfd))
-	    {
-	    case bfd_target_aout_flavour:
-	      /* Assume it's an old APCS-style ABI.  */
-	      osabi = GDB_OSABI_ARM_APCS;
-	      break;
+	case bfd_target_aout_flavour:
+	  /* Assume it's an old APCS-style ABI.  */
+	  info.osabi = GDB_OSABI_ARM_APCS;
+	  break;
 
-	    case bfd_target_coff_flavour:
-	      /* Assume it's an old APCS-style ABI.  */
-	      /* XXX WinCE?  */
-	      osabi = GDB_OSABI_ARM_APCS;
-	      break;
+	case bfd_target_coff_flavour:
+	  /* Assume it's an old APCS-style ABI.  */
+	  /* XXX WinCE?  */
+	  info.osabi = GDB_OSABI_ARM_APCS;
+	  break;
 
-	    default:
-	      /* Leave it as "unknown".  */
-	    }
+	default:
+	  /* Leave it as "unknown".  */
 	}
     }
 
-  /* 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;
-    }
+  /* If there is already a candidate, use it.  */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
   tdep = xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
@@ -2860,8 +2850,6 @@ arm_gdbarch_init (struct gdbarch_info in
      ready to unwind the PC first (see frame.c:get_prev_frame()).  */
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
 
-  tdep->osabi = osabi;
-
   /* This is the way it has always defaulted.  */
   tdep->fp_model = ARM_FLOAT_FPA;
 
@@ -2992,7 +2980,7 @@ arm_gdbarch_init (struct gdbarch_info in
 					 arm_coff_make_msymbol_special);
 
   /* Hook in the ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   /* Now we have tuned the configuration, set a few final things,
      based on what the OS ABI has told us.  */
@@ -3057,9 +3045,6 @@ arm_dump_tdep (struct gdbarch *current_g
 
   if (tdep == NULL)
     return;
-
-  fprintf_unfiltered (file, "arm_dump_tdep: OS ABI = %s\n",
-		      gdbarch_osabi_name (tdep->osabi));
 
   fprintf_unfiltered (file, "arm_dump_tdep: Lowest pc = 0x%lx",
 		      (unsigned long) tdep->lowest_pc);
Index: arm-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.h,v
retrieving revision 1.9
diff -u -p -r1.9 arm-tdep.h
--- arm-tdep.h	21 May 2002 15:36:03 -0000	1.9
+++ arm-tdep.h	4 Jan 2003 23:30:49 -0000
@@ -1,5 +1,5 @@
 /* Common target dependent code for GDB on ARM systems.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -18,8 +18,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include "osabi.h"
-
 /* Register numbers of various important registers.  Note that some of
    these values are "real" register numbers, and correspond to the
    general registers of the machine, and some are "phony" register
@@ -124,8 +122,6 @@ enum arm_float_model
 /* Target-dependent structure in gdbarch.  */
 struct gdbarch_tdep
 {
-  enum gdb_osabi osabi;		/* OS/ABI of inferior.  */
-
   enum arm_float_model fp_model; /* Floating point calling conventions.  */
 
   CORE_ADDR lowest_pc;		/* Lowest address at which instructions 
Index: armnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/armnbsd-tdep.c,v
retrieving revision 1.8
diff -u -p -r1.8 armnbsd-tdep.c
--- armnbsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.8
+++ armnbsd-tdep.c	4 Jan 2003 23:30:49 -0000
@@ -1,5 +1,5 @@
 /* Target-specific functions for ARM running under NetBSD.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "osabi.h"
 
 #include "arm-tdep.h"
 #include "nbsd-tdep.h"
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.105
diff -u -p -r1.105 defs.h
--- defs.h	2 Jan 2003 14:27:26 -0000	1.105
+++ defs.h	4 Jan 2003 23:30:50 -0000
@@ -977,6 +977,39 @@ extern void warning (const char *, ...) 
 
 extern void vwarning (const char *, va_list args);
 
+/* List of known OS ABIs.  If you change this, make sure to update the
+   table in osabi.c.  */
+enum gdb_osabi
+{
+  GDB_OSABI_UNINITIALIZED = -1, /* For struct gdbarch_info.  */
+
+  GDB_OSABI_UNKNOWN = 0,	/* keep this zero */
+
+  GDB_OSABI_SVR4,
+  GDB_OSABI_HURD,
+  GDB_OSABI_SOLARIS,
+  GDB_OSABI_OSF1,
+  GDB_OSABI_LINUX,
+  GDB_OSABI_FREEBSD_AOUT,
+  GDB_OSABI_FREEBSD_ELF,
+  GDB_OSABI_NETBSD_AOUT,
+  GDB_OSABI_NETBSD_ELF,
+  GDB_OSABI_WINCE,
+  GDB_OSABI_GO32,
+  GDB_OSABI_NETWARE,
+  GDB_OSABI_IRIX,
+  GDB_OSABI_LYNXOS,
+  GDB_OSABI_INTERIX,
+  GDB_OSABI_HPUX_ELF,
+  GDB_OSABI_HPUX_SOM,
+
+  GDB_OSABI_ARM_EABI_V1,
+  GDB_OSABI_ARM_EABI_V2,
+  GDB_OSABI_ARM_APCS,
+
+  GDB_OSABI_INVALID		/* keep this last */
+};
+
 /* Global functions from other, non-gdb GNU thingies.
    Libiberty thingies are no longer declared here.  We include libiberty.h
    above, instead.  */
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.174
diff -u -p -r1.174 gdbarch.c
--- gdbarch.c	4 Jan 2003 22:37:46 -0000	1.174
+++ gdbarch.c	4 Jan 2003 23:30:50 -0000
@@ -65,6 +65,7 @@
 #include "gdb_string.h"
 #include "gdb-events.h"
 #include "reggroups.h"
+#include "osabi.h"
 
 /* Static function declarations */
 
@@ -93,6 +94,7 @@ struct gdbarch
   /* basic architectural information */
   const struct bfd_arch_info * bfd_arch_info;
   int byte_order;
+  enum gdb_osabi osabi;
 
   /* target specific vector. */
   struct gdbarch_tdep *tdep;
@@ -289,6 +291,7 @@ struct gdbarch startup_gdbarch =
   /* basic architecture information */
   &bfd_default_arch_struct,
   BFD_ENDIAN_BIG,
+  GDB_OSABI_UNKNOWN,
   /* target specific vector and its dump routine */
   NULL, NULL,
   /*per-architecture data-pointers and swap regions */
@@ -478,6 +481,7 @@ gdbarch_alloc (const struct gdbarch_info
 
   current_gdbarch->bfd_arch_info = info->bfd_arch_info;
   current_gdbarch->byte_order = info->byte_order;
+  current_gdbarch->osabi = info->osabi;
 
   /* Force the explicit initialization of these. */
   current_gdbarch->short_bit = 2*TARGET_CHAR_BIT;
@@ -2380,6 +2384,14 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: TARGET_LONG_LONG_BIT = %d\n",
                       TARGET_LONG_LONG_BIT);
 #endif
+#ifdef TARGET_OSABI
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_OSABI # %s\n",
+                      XSTRING (TARGET_OSABI));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_OSABI = %ld\n",
+                      (long) TARGET_OSABI);
+#endif
 #ifdef TARGET_PRINT_INSN
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -2538,6 +2550,15 @@ gdbarch_byte_order (struct gdbarch *gdba
   return gdbarch->byte_order;
 }
 
+enum gdb_osabi
+gdbarch_osabi (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_osabi called\n");
+  return gdbarch->osabi;
+}
+
 int
 gdbarch_short_bit (struct gdbarch *gdbarch)
 {
@@ -5745,6 +5766,8 @@ gdbarch_list_lookup_by_info (struct gdba
 	continue;
       if (info->byte_order != arches->gdbarch->byte_order)
 	continue;
+      if (info->osabi != arches->gdbarch->osabi)
+	continue;
       return arches;
     }
   return NULL;
@@ -5790,6 +5813,12 @@ gdbarch_update_p (struct gdbarch_info in
   if (info.byte_order == BFD_ENDIAN_UNKNOWN)
     info.byte_order = TARGET_BYTE_ORDER;
 
+  /* ``(gdb) set osabi ...'' is handled by gdbarch_lookup_osabi.  */
+  if (info.osabi == GDB_OSABI_UNINITIALIZED)
+    info.osabi = gdbarch_lookup_osabi (info.abfd);
+  if (info.osabi == GDB_OSABI_UNINITIALIZED)
+    info.osabi = current_gdbarch->osabi;
+
   /* Must have found some sort of architecture. */
   gdb_assert (info.bfd_arch_info != NULL);
 
@@ -5806,6 +5835,9 @@ gdbarch_update_p (struct gdbarch_info in
 			  (info.byte_order == BFD_ENDIAN_BIG ? "big"
 			   : info.byte_order == BFD_ENDIAN_LITTLE ? "little"
 			   : "default"));
+      fprintf_unfiltered (gdb_stdlog,
+			  "gdbarch_update: info.osabi %d (%s)\n",
+			  info.osabi, gdbarch_osabi_name (info.osabi));
       fprintf_unfiltered (gdb_stdlog,
 			  "gdbarch_update: info.abfd 0x%lx\n",
 			  (long) info.abfd);
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.135
diff -u -p -r1.135 gdbarch.h
--- gdbarch.h	4 Jan 2003 22:37:47 -0000	1.135
+++ gdbarch.h	4 Jan 2003 23:30:51 -0000
@@ -95,6 +95,17 @@ extern int gdbarch_byte_order (struct gd
 #endif
 #endif
 
+extern enum gdb_osabi gdbarch_osabi (struct gdbarch *gdbarch);
+/* set_gdbarch_osabi() - not applicable - pre-initialized. */
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_OSABI)
+#error "Non multi-arch definition of TARGET_OSABI"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_OSABI)
+#define TARGET_OSABI (gdbarch_osabi (current_gdbarch))
+#endif
+#endif
+
 
 /* The following are initialized by the target dependent code. */
 
@@ -2841,6 +2852,9 @@ struct gdbarch_info
 
   /* Use default: NULL (ZERO). */
   struct gdbarch_tdep_info *tdep_info;
+
+  /* Use default: GDB_OSABI_UNINITIALIZED (-1).  */
+  enum gdb_osabi osabi;
 };
 
 typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.186
diff -u -p -r1.186 gdbarch.sh
--- gdbarch.sh	4 Jan 2003 22:37:47 -0000	1.186
+++ gdbarch.sh	4 Jan 2003 23:30:51 -0000
@@ -387,6 +387,8 @@ function_list ()
 i:2:TARGET_ARCHITECTURE:const struct bfd_arch_info *:bfd_arch_info::::&bfd_default_arch_struct::::%s:TARGET_ARCHITECTURE->printable_name:TARGET_ARCHITECTURE != NULL
 #
 i:2:TARGET_BYTE_ORDER:int:byte_order::::BFD_ENDIAN_BIG
+#
+i:2:TARGET_OSABI:enum gdb_osabi:osabi::::GDB_OSABI_UNKNOWN
 # Number of bits in a char or unsigned char for the target machine.
 # Just like CHAR_BIT in <limits.h> but describes the target machine.
 # v::TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
@@ -1043,6 +1045,9 @@ struct gdbarch_info
 
   /* Use default: NULL (ZERO). */
   struct gdbarch_tdep_info *tdep_info;
+
+  /* Use default: GDB_OSABI_UNINITIALIZED (-1).  */
+  enum gdb_osabi osabi;
 };
 
 typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
@@ -1263,6 +1268,7 @@ cat <<EOF
 #include "gdb_string.h"
 #include "gdb-events.h"
 #include "reggroups.h"
+#include "osabi.h"
 
 /* Static function declarations */
 
@@ -2133,6 +2139,8 @@ gdbarch_list_lookup_by_info (struct gdba
 	continue;
       if (info->byte_order != arches->gdbarch->byte_order)
 	continue;
+      if (info->osabi != arches->gdbarch->osabi)
+	continue;
       return arches;
     }
   return NULL;
@@ -2178,6 +2186,12 @@ gdbarch_update_p (struct gdbarch_info in
   if (info.byte_order == BFD_ENDIAN_UNKNOWN)
     info.byte_order = TARGET_BYTE_ORDER;
 
+  /* \`\`(gdb) set osabi ...'' is handled by gdbarch_lookup_osabi.  */
+  if (info.osabi == GDB_OSABI_UNINITIALIZED)
+    info.osabi = gdbarch_lookup_osabi (info.abfd);
+  if (info.osabi == GDB_OSABI_UNINITIALIZED)
+    info.osabi = current_gdbarch->osabi;
+
   /* Must have found some sort of architecture. */
   gdb_assert (info.bfd_arch_info != NULL);
 
@@ -2194,6 +2208,9 @@ gdbarch_update_p (struct gdbarch_info in
 			  (info.byte_order == BFD_ENDIAN_BIG ? "big"
 			   : info.byte_order == BFD_ENDIAN_LITTLE ? "little"
 			   : "default"));
+      fprintf_unfiltered (gdb_stdlog,
+			  "gdbarch_update: info.osabi %d (%s)\n",
+			  info.osabi, gdbarch_osabi_name (info.osabi));
       fprintf_unfiltered (gdb_stdlog,
 			  "gdbarch_update: info.abfd 0x%lx\n",
 			  (long) info.abfd);
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.44
diff -u -p -r1.44 hppa-tdep.c
--- hppa-tdep.c	4 Jan 2003 22:37:47 -0000	1.44
+++ hppa-tdep.c	4 Jan 2003 23:30:52 -0000
@@ -4945,19 +4945,13 @@ static struct gdbarch *
 hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
   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)
+  if (info.abfd != NULL && info.osabi == GDB_OSABI_UNKNOWN)
     {
-      osabi = gdbarch_lookup_osabi (info.abfd);
-      if (osabi == GDB_OSABI_UNKNOWN)
-	{
-	  /* If it's a SOM file, assume it's HP/UX SOM.  */
-	  if (bfd_get_flavour (info.abfd) == bfd_target_som_flavour)
-	    osabi = GDB_OSABI_HPUX_SOM;
-	}
+      /* If it's a SOM file, assume it's HP/UX SOM.  */
+      if (bfd_get_flavour (info.abfd) == bfd_target_som_flavour)
+	info.osabi = GDB_OSABI_HPUX_SOM;
     }
 
   /* find a candidate among the list of pre-declared architectures.  */
@@ -4969,7 +4963,7 @@ hppa_gdbarch_init (struct gdbarch_info i
   gdbarch = gdbarch_alloc (&info, NULL);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   set_gdbarch_reg_struct_has_addr (gdbarch, hppa_reg_struct_has_addr);
   set_gdbarch_function_start_offset (gdbarch, 0);
Index: i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.20
diff -u -p -r1.20 i386-linux-tdep.c
--- i386-linux-tdep.c	21 Dec 2002 19:58:07 -0000	1.20
+++ i386-linux-tdep.c	4 Jan 2003 23:30:52 -0000
@@ -1,6 +1,6 @@
 /* Target-dependent code for GNU/Linux running on i386's, for GDB.
 
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -33,6 +33,8 @@
 #include "objfiles.h"
 
 #include "solib-svr4.h"		/* For struct link_map_offsets.  */
+
+#include "osabi.h"
 
 #include "i386-tdep.h"
 #include "i386-linux-tdep.h"
Index: i386-sol2-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-sol2-tdep.c,v
retrieving revision 1.9
diff -u -p -r1.9 i386-sol2-tdep.c
--- i386-sol2-tdep.c	4 Jan 2003 22:37:47 -0000	1.9
+++ i386-sol2-tdep.c	4 Jan 2003 23:30:53 -0000
@@ -20,6 +20,7 @@
 
 #include "defs.h"
 #include "value.h"
+#include "osabi.h"
 
 #include "i386-tdep.h"
 
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.106
diff -u -p -r1.106 i386-tdep.c
--- i386-tdep.c	3 Jan 2003 23:53:47 -0000	1.106
+++ i386-tdep.c	4 Jan 2003 23:30:53 -0000
@@ -1,7 +1,7 @@
 /* Intel 386 target-dependent stuff.
 
    Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -39,6 +39,7 @@
 #include "gdb_assert.h"
 #include "reggroups.h"
 #include "dummy-frame.h"
+#include "osabi.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
@@ -1499,22 +1500,11 @@ i386_gdbarch_init (struct gdbarch_info i
 {
   struct gdbarch_tdep *tdep;
   struct gdbarch *gdbarch;
-  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
-  /* Try to determine the OS ABI of the object we're 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 OS ABI selection matches.  */
-      tdep = gdbarch_tdep (arches->gdbarch);
-      if (tdep && tdep->osabi == osabi)
-        return arches->gdbarch;
-    }
+  /* If there is already a candidate, use it.  */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
   /* Allocate space for the new architecture.  */
   tdep = XMALLOC (struct gdbarch_tdep);
@@ -1524,8 +1514,6 @@ i386_gdbarch_init (struct gdbarch_info i
      ready to unwind the PC first (see frame.c:get_prev_frame()).  */
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
 
-  tdep->osabi = osabi;
-
   /* The i386 default settings don't include the SSE registers.
      FIXME: kettenis/20020614: They do include the FPU registers for
      now, which probably is not quite right.  */
@@ -1652,7 +1640,7 @@ i386_gdbarch_init (struct gdbarch_info i
   set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   return gdbarch;
 }
Index: i386-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.h,v
retrieving revision 1.19
diff -u -p -r1.19 i386-tdep.h
--- i386-tdep.h	8 Nov 2002 23:59:58 -0000	1.19
+++ i386-tdep.h	4 Jan 2003 23:30:53 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for GDB, the GNU debugger.
-   Copyright 2001, 2002
+   Copyright 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -22,8 +22,6 @@
 #ifndef I386_TDEP_H
 #define I386_TDEP_H
 
-#include "osabi.h"
-
 /* GDB's i386 target supports both the 32-bit Intel Architecture
    (IA-32) and the 64-bit AMD x86-64 architecture.  Internally it uses
    a similar register layout for both.
@@ -53,9 +51,6 @@ enum struct_return
 /* i386 architecture specific information.  */
 struct gdbarch_tdep
 {
-  /* ABI.  */
-  enum gdb_osabi osabi;
-
   /* Number of SSE registers.  */
   int num_xmm_regs;
 
Index: i386bsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386bsd-tdep.c,v
retrieving revision 1.11
diff -u -p -r1.11 i386bsd-tdep.c
--- i386bsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.11
+++ i386bsd-tdep.c	4 Jan 2003 23:30:53 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for i386 BSD's.
-   Copyright 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,6 +23,7 @@
 #include "frame.h"
 #include "gdbcore.h"
 #include "regcache.h"
+#include "osabi.h"
 
 #include "gdb_string.h"
 
Index: i386gnu-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386gnu-tdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 i386gnu-tdep.c
--- i386gnu-tdep.c	21 Dec 2002 19:58:07 -0000	1.2
+++ i386gnu-tdep.c	4 Jan 2003 23:30:53 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for the GNU Hurd.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "osabi.h"
 
 #include "i386-tdep.h"
 
Index: i386ly-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386ly-tdep.c,v
retrieving revision 1.6
diff -u -p -r1.6 i386ly-tdep.c
--- i386ly-tdep.c	21 Dec 2002 19:58:07 -0000	1.6
+++ i386ly-tdep.c	4 Jan 2003 23:30:53 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for Intel 386 running LynxOS.
-   Copyright 1993, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1993, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,6 +23,7 @@
 #include "inferior.h"
 #include "regcache.h"
 #include "target.h"
+#include "osabi.h"
 
 #include "i386-tdep.h"
 
Index: i386nbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386nbsd-tdep.c,v
retrieving revision 1.12
diff -u -p -r1.12 i386nbsd-tdep.c
--- i386nbsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.12
+++ i386nbsd-tdep.c	4 Jan 2003 23:30:53 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for NetBSD/i386, for GDB.
-   Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002
+   Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -24,6 +24,7 @@
 #include "gdbcore.h"
 #include "regcache.h"
 #include "arch-utils.h"
+#include "osabi.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
Index: i386obsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386obsd-tdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 i386obsd-tdep.c
--- i386obsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.2
+++ i386obsd-tdep.c	4 Jan 2003 23:30:53 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for OpenBSD/i386.
-   Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002
+   Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -23,6 +23,7 @@
 #include "arch-utils.h"
 #include "gdbcore.h"
 #include "regcache.h"
+#include "osabi.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.152
diff -u -p -r1.152 mips-tdep.c
--- mips-tdep.c	4 Jan 2003 22:37:47 -0000	1.152
+++ mips-tdep.c	4 Jan 2003 23:30:54 -0000
@@ -129,8 +129,6 @@ struct gdbarch_tdep
     int mips_default_stack_argsize;
     int gdb_target_is_mips64;
     int default_mask_address_p;
-
-    enum gdb_osabi osabi;
   };
 
 #define MIPS_EABI (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \
@@ -5607,7 +5605,6 @@ mips_gdbarch_init (struct gdbarch_info i
   struct gdbarch_tdep *tdep;
   int elf_flags;
   enum mips_abi mips_abi, found_abi, wanted_abi;
-  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
   /* Reset the disassembly info, in case it was set to something
      non-default.  */
@@ -5622,10 +5619,6 @@ mips_gdbarch_init (struct gdbarch_info i
       /* First of all, extract the elf_flags, if available.  */
       if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
 	elf_flags = elf_elfheader (info.abfd)->e_flags;
-
-      /* Try to determine the OS ABI of the object we are loading.  If
-	 we end up with `unknown', just leave it that way.  */
-      osabi = gdbarch_lookup_osabi (info.abfd);
     }
 
   /* Check ELF_FLAGS to see if it specifies the ABI being used.  */
@@ -5722,15 +5715,13 @@ mips_gdbarch_init (struct gdbarch_info i
 	continue;
       if (gdbarch_tdep (arches->gdbarch)->mips_abi != mips_abi)
 	continue;
-      if (gdbarch_tdep (arches->gdbarch)->osabi == osabi)
-        return arches->gdbarch;
+      return arches->gdbarch;
     }
 
   /* Need a new architecture.  Fill in a target specific vector.  */
   tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
   tdep->elf_flags = elf_flags;
-  tdep->osabi = osabi;
 
   /* Initially set everything according to the default ABI/ISA.  */
   set_gdbarch_short_bit (gdbarch, 16);
@@ -5747,7 +5738,7 @@ mips_gdbarch_init (struct gdbarch_info i
   set_gdbarch_elf_make_msymbol_special (gdbarch, 
 					mips_elf_make_msymbol_special);
 
-  if (osabi == GDB_OSABI_IRIX)
+  if (info.osabi == GDB_OSABI_IRIX)
     set_gdbarch_num_regs (gdbarch, 71);
   else
     set_gdbarch_num_regs (gdbarch, 90);
@@ -6027,7 +6018,7 @@ mips_gdbarch_init (struct gdbarch_info i
   set_gdbarch_pc_in_sigtramp (gdbarch, mips_pc_in_sigtramp);
 
   /* Hook in OS ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   set_gdbarch_store_struct_return (gdbarch, mips_store_struct_return);
   set_gdbarch_extract_struct_value_address (gdbarch, 
@@ -6432,10 +6423,6 @@ mips_dump_tdep (struct gdbarch *current_
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: _PROC_MAGIC_ = %d\n",
 		      _PROC_MAGIC_);
-
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: OS ABI = %s\n",
-		      gdbarch_osabi_name (tdep->osabi));
 }
 
 void
Index: ns32k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ns32k-tdep.c,v
retrieving revision 1.27
diff -u -p -r1.27 ns32k-tdep.c
--- ns32k-tdep.c	3 Jan 2003 23:53:48 -0000	1.27
+++ ns32k-tdep.c	4 Jan 2003 23:30:54 -0000
@@ -1,6 +1,6 @@
 /* Target dependent code for the NS32000, for GDB.
    Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000, 2001,
-   2002 Free Software Foundation, Inc.
+   2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -26,8 +26,8 @@
 #include "inferior.h"
 #include "regcache.h"
 #include "target.h"
-
 #include "arch-utils.h"
+#include "osabi.h"
 
 #include "ns32k-tdep.h"
 #include "gdb_string.h"
@@ -536,36 +536,19 @@ ns32k_gdbarch_init_32382 (struct gdbarch
 static struct gdbarch *
 ns32k_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 OS ABI of the object we are loading.  */
-  if (info.abfd != NULL)
-    {
-      osabi = gdbarch_lookup_osabi (info.abfd);
-    }
+  /* If there is already a candidate, use it.  */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
-  /* 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 OS 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);
+  gdbarch = gdbarch_alloc (&info, NULL);
 
   /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
      ready to unwind the PC first (see frame.c:get_prev_frame()).  */
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
 
-  tdep->osabi = osabi;
-
   /* Register info */
   ns32k_gdbarch_init_32082 (gdbarch);
   set_gdbarch_num_regs (gdbarch, NS32K_SP_REGNUM);
@@ -631,27 +614,15 @@ ns32k_gdbarch_init (struct gdbarch_info 
   set_gdbarch_function_start_offset (gdbarch, 0);
 
   /* Hook in OS ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   return (gdbarch);
 }
 
-static void
-ns32k_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, "ns32k_dump_tdep: OS ABI = %s\n",
-		      gdbarch_osabi_name (tdep->osabi));
-}
-
 void
 _initialize_ns32k_tdep (void)
 {
-  gdbarch_register (bfd_arch_ns32k, ns32k_gdbarch_init, ns32k_dump_tdep);
+  gdbarch_register (bfd_arch_ns32k, ns32k_gdbarch_init, NULL);
 
   tm_print_insn = print_insn_ns32k;
 }
Index: ns32k-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/ns32k-tdep.h,v
retrieving revision 1.1
diff -u -p -r1.1 ns32k-tdep.h
--- ns32k-tdep.h	27 May 2002 01:05:16 -0000	1.1
+++ ns32k-tdep.h	4 Jan 2003 23:30:54 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent definitions for GDB on NS32000 systems.
-   Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001, 2002
+   Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -22,8 +22,6 @@
 #ifndef NS32K_TDEP_H
 #define NS32K_TDEP_H
 
-#include "osabi.h"
-
 /* Register numbers of various important registers.
    Note that some of these values are "real" register numbers,
    and correspond to the general registers of the machine,
@@ -54,11 +52,6 @@
 #define NS32K_REGISTER_SIZE             4
 #define NS32K_MAX_REGISTER_RAW_SIZE     8
 #define NS32K_MAX_REGISTER_VIRTUAL_SIZE 8
-
-struct gdbarch_tdep
-{
-  enum gdb_osabi osabi;
-};
 
 void ns32k_gdbarch_init_32082 (struct gdbarch *);
 void ns32k_gdbarch_init_32382 (struct gdbarch *);
Index: ns32knbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ns32knbsd-tdep.c,v
retrieving revision 1.3
diff -u -p -r1.3 ns32knbsd-tdep.c
--- ns32knbsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.3
+++ ns32knbsd-tdep.c	4 Jan 2003 23:30:54 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for NS32000 systems running NetBSD.
-   Copyright 2002 Free Software Foundation, Inc. 
+   Copyright 2002, 2003 Free Software Foundation, Inc. 
    Contributed by Wasabi Systems, Inc. 
  
    This file is part of GDB.
@@ -20,6 +20,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "osabi.h"
 
 #include "ns32k-tdep.h"
 #include "gdb_string.h"
Index: osabi.c
===================================================================
RCS file: /cvs/src/src/gdb/osabi.c,v
retrieving revision 1.10
diff -u -p -r1.10 osabi.c
--- osabi.c	21 Dec 2002 19:58:07 -0000	1.10
+++ osabi.c	4 Jan 2003 23:30:54 -0000
@@ -1,5 +1,5 @@
 /* OS ABI variant handling for GDB.
-   Copyright 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -171,6 +171,9 @@ gdbarch_lookup_osabi (bfd *abfd)
   enum gdb_osabi osabi, match;
   int match_specific;
 
+  if (abfd == NULL)
+    return GDB_OSABI_UNINITIALIZED;
+
   match = GDB_OSABI_UNKNOWN;
   match_specific = 0;
 
@@ -234,14 +237,13 @@ gdbarch_lookup_osabi (bfd *abfd)
 }
 
 void
-gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch,
-                    enum gdb_osabi osabi)
+gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
   const struct bfd_arch_info *compatible;
   struct gdb_osabi_handler *handler;
 
-  if (osabi == GDB_OSABI_UNKNOWN)
+  if (info.osabi == GDB_OSABI_UNKNOWN)
     {
       /* Don't complain about an unknown OSABI.  Assume the user knows
          what they are doing.  */
@@ -251,7 +253,7 @@ gdbarch_init_osabi (struct gdbarch_info 
   for (handler = gdb_osabi_handler_list; handler != NULL;
        handler = handler->next)
     {
-      if (handler->osabi != osabi)
+      if (handler->osabi != info.osabi)
 	continue;
 
       /* Check whether the machine type and architecture of the
@@ -279,7 +281,7 @@ gdbarch_init_osabi (struct gdbarch_info 
        "A handler for the OS ABI \"%s\" is not built into this "
        "configuration of GDB.  "
        "Attempting to continue with the default %s settings",
-       gdbarch_osabi_name (osabi),
+       gdbarch_osabi_name (info.osabi),
        bfd_printable_arch_mach (arch_info->arch, arch_info->mach));
 }
 
Index: osabi.h
===================================================================
RCS file: /cvs/src/src/gdb/osabi.h,v
retrieving revision 1.7
diff -u -p -r1.7 osabi.h
--- osabi.h	21 Dec 2002 19:58:07 -0000	1.7
+++ osabi.h	4 Jan 2003 23:30:54 -0000
@@ -1,5 +1,5 @@
 /* OS ABI variant handling for GDB.
-   Copyright 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
    
    This file is part of GDB.
 
@@ -21,37 +21,6 @@
 #ifndef OSABI_H
 #define OSABI_H
 
-/* List of known OS ABIs.  If you change this, make sure to update the
-   table in osabi.c.  */
-enum gdb_osabi
-{
-  GDB_OSABI_UNKNOWN = 0,	/* keep this first */
-
-  GDB_OSABI_SVR4,
-  GDB_OSABI_HURD,
-  GDB_OSABI_SOLARIS,
-  GDB_OSABI_OSF1,
-  GDB_OSABI_LINUX,
-  GDB_OSABI_FREEBSD_AOUT,
-  GDB_OSABI_FREEBSD_ELF,
-  GDB_OSABI_NETBSD_AOUT,
-  GDB_OSABI_NETBSD_ELF,
-  GDB_OSABI_WINCE,
-  GDB_OSABI_GO32,
-  GDB_OSABI_NETWARE,
-  GDB_OSABI_IRIX,
-  GDB_OSABI_LYNXOS,
-  GDB_OSABI_INTERIX,
-  GDB_OSABI_HPUX_ELF,
-  GDB_OSABI_HPUX_SOM,
-
-  GDB_OSABI_ARM_EABI_V1,
-  GDB_OSABI_ARM_EABI_V2,
-  GDB_OSABI_ARM_APCS,
-
-  GDB_OSABI_INVALID		/* keep this last */
-};
-
 /* Register an OS ABI sniffer.  Each arch/flavour may have more than
    one sniffer.  This is used to e.g. differentiate one OS's a.out from
    another.  The first sniffer to return something other than
@@ -73,8 +42,7 @@ void gdbarch_register_osabi (enum bfd_ar
 enum gdb_osabi gdbarch_lookup_osabi (bfd *);
 
 /* Initialize the gdbarch for the specified OS ABI variant.  */
-void gdbarch_init_osabi (struct gdbarch_info, struct gdbarch *,
-                         enum gdb_osabi);
+void gdbarch_init_osabi (struct gdbarch_info, struct gdbarch *);
 
 /* Return the name of the specified OS ABI.  */
 const char *gdbarch_osabi_name (enum gdb_osabi);
Index: ppc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
retrieving revision 1.21
diff -u -p -r1.21 ppc-linux-tdep.c
--- ppc-linux-tdep.c	21 Dec 2002 19:58:07 -0000	1.21
+++ ppc-linux-tdep.c	4 Jan 2003 23:30:55 -0000
@@ -1,7 +1,7 @@
 /* Target-dependent code for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 2000, 2001, 2002 Free Software Foundation, Inc.
+   1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -31,6 +31,7 @@
 #include "objfiles.h"
 #include "regcache.h"
 #include "value.h"
+#include "osabi.h"
 
 #include "solib-svr4.h"
 #include "ppc-tdep.h"
Index: ppc-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/ppc-tdep.h,v
retrieving revision 1.13
diff -u -p -r1.13 ppc-tdep.h
--- ppc-tdep.h	20 Aug 2002 22:24:29 -0000	1.13
+++ ppc-tdep.h	4 Jan 2003 23:30:55 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for GDB, the GNU debugger.
-   Copyright 2000
+   Copyright 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -22,8 +22,6 @@
 #ifndef PPC_TDEP_H
 #define PPC_TDEP_H
 
-#include "osabi.h"
-
 struct frame_info;
 struct value;
 
@@ -56,7 +54,6 @@ int altivec_register_p (int regno);
 struct gdbarch_tdep
   {
     int wordsize;              /* size in bytes of fixed-point word */
-    enum gdb_osabi osabi;      /* OS / ABI from ELF header */
     int *regoff;               /* byte offsets in register arrays */
     const struct reg *regs;    /* from current variant */
     int ppc_gp0_regnum;		/* GPR register 0 */
Index: ppcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcnbsd-tdep.c,v
retrieving revision 1.5
diff -u -p -r1.5 ppcnbsd-tdep.c
--- ppcnbsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.5
+++ ppcnbsd-tdep.c	4 Jan 2003 23:30:55 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for PowerPC systems running NetBSD.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
    Contributed by Wasabi Systems, Inc.
 
    This file is part of GDB.
@@ -25,6 +25,7 @@
 #include "target.h"
 #include "breakpoint.h"
 #include "value.h"
+#include "osabi.h"
 
 #include "ppc-tdep.h"
 #include "ppcnbsd-tdep.h"
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.101
diff -u -p -r1.101 rs6000-tdep.c
--- rs6000-tdep.c	4 Jan 2003 22:37:47 -0000	1.101
+++ rs6000-tdep.c	4 Jan 2003 23:30:55 -0000
@@ -34,6 +34,7 @@
 #include "doublest.h"
 #include "value.h"
 #include "parser-defs.h"
+#include "osabi.h"
 
 #include "libbfd.h"		/* for bfd_default_set_arch_mach */
 #include "coff/internal.h"	/* for libcoff.h */
@@ -2657,7 +2658,6 @@ rs6000_gdbarch_init (struct gdbarch_info
   unsigned long mach;
   bfd abfd;
   int sysv_abi;
-  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
   asection *sect;
 
   from_xcoff_exec = info.abfd && info.abfd->format == bfd_object &&
@@ -2668,9 +2668,6 @@ rs6000_gdbarch_init (struct gdbarch_info
 
   sysv_abi = info.abfd && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour;
 
-  if (info.abfd)
-    osabi = gdbarch_lookup_osabi (info.abfd);
-
   /* Check word size.  If INFO is from a binary file, infer it from
      that, else choose a likely default.  */
   if (from_xcoff_exec)
@@ -2705,7 +2702,7 @@ rs6000_gdbarch_init (struct gdbarch_info
          meaningful, because 64-bit CPUs can run in 32-bit mode.  So, perform
          separate word size check.  */
       tdep = gdbarch_tdep (arches->gdbarch);
-      if (tdep && tdep->wordsize == wordsize && tdep->osabi == osabi)
+      if (tdep && tdep->wordsize == wordsize)
 	return arches->gdbarch;
     }
 
@@ -2731,7 +2728,6 @@ rs6000_gdbarch_init (struct gdbarch_info
     }
   tdep = xmalloc (sizeof (struct gdbarch_tdep));
   tdep->wordsize = wordsize;
-  tdep->osabi = osabi;
 
   /* For e500 executables, the apuinfo section is of help here.  Such
      section contains the identifier and revision number of each
@@ -2958,7 +2954,7 @@ rs6000_gdbarch_init (struct gdbarch_info
   set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   return gdbarch;
 }
@@ -2971,8 +2967,7 @@ rs6000_dump_tdep (struct gdbarch *curren
   if (tdep == NULL)
     return;
 
-  fprintf_unfiltered (file, "rs6000_dump_tdep: OS ABI = %s\n",
-		      gdbarch_osabi_name (tdep->osabi));
+  /* FIXME: Dump gdbarch_tdep.  */
 }
 
 static struct cmd_list_element *info_powerpc_cmdlist = NULL;
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.86
diff -u -p -r1.86 sh-tdep.c
--- sh-tdep.c	4 Jan 2003 22:37:47 -0000	1.86
+++ sh-tdep.c	4 Jan 2003 23:30:56 -0000
@@ -39,6 +39,7 @@
 #include "floatformat.h"
 #include "regcache.h"
 #include "doublest.h"
+#include "osabi.h"
 
 #include "sh-tdep.h"
 
@@ -4210,26 +4211,11 @@ sh_gdbarch_init (struct gdbarch_info inf
   gdbarch_register_name_ftype *sh_register_name;
   gdbarch_deprecated_store_return_value_ftype *sh_store_return_value;
   gdbarch_register_virtual_type_ftype *sh_register_virtual_type;
-  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);
-      /* If we get "unknown" back, just leave it that way.  */
-    }
-
-  /* Find a candidate among the list of pre-declared 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;
-    }
+  /* If there is already a candidate, use it.  */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
   /* None found, create a new architecture from the information
      provided. */
@@ -4240,8 +4226,6 @@ sh_gdbarch_init (struct gdbarch_info inf
      ready to unwind the PC first (see frame.c:get_prev_frame()).  */
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
 
-  tdep->osabi = osabi;
-
   /* Initialize the register numbers that are not common to all the
      variants to -1, if necessary thse will be overwritten in the case
      statement below. */
@@ -4587,11 +4571,8 @@ sh_gdbarch_init (struct gdbarch_info inf
   set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-  /* Hook in ABI-specific overrides, if they have been registered.
-
-     FIXME: if the ABI is unknown, this is probably an embedded target,
-     so we should not warn about this situation.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  /* Hook in ABI-specific overrides, if they have been registered.  */
+  gdbarch_init_osabi (info, gdbarch);
 
   return gdbarch;
 }
@@ -4604,8 +4585,7 @@ sh_dump_tdep (struct gdbarch *current_gd
   if (tdep == NULL)
     return;
 
-  fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n",
-                      gdbarch_osabi_name (tdep->osabi));
+  /* FIXME: dump the rest of gdbarch_tdep.  */
 }
 
 void
Index: sh-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.h,v
retrieving revision 1.2
diff -u -p -r1.2 sh-tdep.h
--- sh-tdep.h	21 May 2002 15:36:02 -0000	1.2
+++ sh-tdep.h	4 Jan 2003 23:30:56 -0000
@@ -1,5 +1,5 @@
 /* Target-specific definition for a Hitachi Super-H.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -22,8 +22,6 @@
 #ifndef SH_TDEP_H
 #define SH_TDEP_H
 
-#include "osabi.h"
-
 /* Contributed by Steve Chamberlain sac@cygnus.com */
 
 /* Information that is dependent on the processor variant. */
@@ -89,7 +87,6 @@ struct gdbarch_tdep
     int ARGLAST_REGNUM;
     int FLOAT_ARGLAST_REGNUM;
     int RETURN_REGNUM;
-    enum gdb_osabi osabi;	/* OS/ABI of the inferior */
     enum sh_abi sh_abi;
   };
 
Index: shnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/shnbsd-tdep.c,v
retrieving revision 1.8
diff -u -p -r1.8 shnbsd-tdep.c
--- shnbsd-tdep.c	21 Dec 2002 19:58:07 -0000	1.8
+++ shnbsd-tdep.c	4 Jan 2003 23:30:56 -0000
@@ -1,5 +1,5 @@
 /* Target-dependent code for SuperH running NetBSD, for GDB.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
    Contributed by Wasabi Systems, Inc.
 
    This file is part of GDB.
@@ -23,6 +23,7 @@
 #include "gdbcore.h"
 #include "regcache.h"
 #include "value.h"
+#include "osabi.h"
 
 #include "solib-svr4.h"
 
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.56
diff -u -p -r1.56 sparc-tdep.c
--- sparc-tdep.c	4 Jan 2003 22:37:47 -0000	1.56
+++ sparc-tdep.c	4 Jan 2003 23:30:57 -0000
@@ -111,8 +111,6 @@ struct gdbarch_tdep
     int reg_save_offset;
     int call_dummy_call_offset;
     int print_insn_mach;
-
-    enum gdb_osabi osabi;
   };
 
 /* Now make GDB_TARGET_IS_SPARC64 a runtime test.  */
@@ -3069,7 +3067,6 @@ sparc_gdbarch_init (struct gdbarch_info 
 {
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
-  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
   static LONGEST call_dummy_32[] = 
     { 0xbc100001, 0x9de38000, 0xbc100002, 0xbe100003,
@@ -3095,27 +3092,18 @@ sparc_gdbarch_init (struct gdbarch_info 
 
   /* Try to determine the OS ABI of the object we are loading.  */
 
-  if (info.abfd != NULL)
+  if (info.abfd != NULL
+      && info.osabi == GDB_OSABI_UNKNOWN)
     {
-      osabi = gdbarch_lookup_osabi (info.abfd);
-      if (osabi == GDB_OSABI_UNKNOWN)
-	{
-	  /* If it's an ELF file, assume it's Solaris.  */
-	  if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
-	    osabi = GDB_OSABI_SOLARIS;
-	}
+      /* If it's an ELF file, assume it's Solaris.  */
+      if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
+	info.osabi = GDB_OSABI_SOLARIS;
     }
 
   /* First see if there is already a gdbarch that can satisfy the request.  */
-  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;
-    }
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
   /* None found: is the request for a sparc architecture? */
   if (info.bfd_arch_info->arch != bfd_arch_sparc)
@@ -3125,8 +3113,6 @@ sparc_gdbarch_init (struct gdbarch_info 
   tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
 
-  tdep->osabi = osabi;
-
   /* First set settings that are common for all sparc architectures.  */
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
   set_gdbarch_breakpoint_from_pc (gdbarch, memory_breakpoint_from_pc);
@@ -3435,7 +3421,7 @@ sparc_gdbarch_init (struct gdbarch_info 
     }
 
   /* Hook in OS ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   return gdbarch;
 }
@@ -3448,6 +3434,20 @@ sparc_dump_tdep (struct gdbarch *current
   if (tdep == NULL)
     return;
 
-  fprintf_unfiltered (file, "sparc_dump_tdep: OS ABI = %s\n",
-		      gdbarch_osabi_name (tdep->osabi));
+  fprintf_unfiltered (file, "sparc_dump_tdep: has_fpu = %d\n",
+		      tdep->has_fpu);
+  fprintf_unfiltered (file, "sparc_dump_tdep: fp_register_bytes = %d\n",
+		      tdep->fp_register_bytes);
+  fprintf_unfiltered (file, "sparc_dump_tdep: y_regnum = %d\n",
+		      tdep->y_regnum);
+  fprintf_unfiltered (file, "sparc_dump_tdep: fp_max_regnum = %d\n",
+		      tdep->fp_max_regnum);
+  fprintf_unfiltered (file, "sparc_dump_tdep: intreg_size = %d\n",
+		      tdep->intreg_size);
+  fprintf_unfiltered (file, "sparc_dump_tdep: reg_save_offset = %d\n",
+		      tdep->reg_save_offset);
+  fprintf_unfiltered (file, "sparc_dump_tdep: call_dummy_call_offset = %d\n",
+		      tdep->call_dummy_call_offset);
+  fprintf_unfiltered (file, "sparc_dump_tdep: print_insn_match = %d\n",
+		      tdep->print_insn_match);
 }
Index: vax-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/vax-tdep.c,v
retrieving revision 1.28
diff -u -p -r1.28 vax-tdep.c
--- vax-tdep.c	3 Jan 2003 23:53:48 -0000	1.28
+++ vax-tdep.c	4 Jan 2003 23:30:57 -0000
@@ -1,5 +1,5 @@
 /* Print VAX instructions for GDB, the GNU debugger.
-   Copyright 1986, 1989, 1991, 1992, 1995, 1996, 1998, 1999, 2000, 2002
+   Copyright 1986, 1989, 1991, 1992, 1995, 1996, 1998, 1999, 2000, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -29,6 +29,7 @@
 #include "value.h"
 #include "arch-utils.h"
 #include "gdb_string.h"
+#include "osabi.h"
 
 #include "vax-tdep.h"
 
@@ -609,35 +610,19 @@ print_insn_arg (char *d, register char *
 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 there is already a candidate, use it.  */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
-  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);
+  gdbarch = gdbarch_alloc (&info, NULL);
 
   /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
      ready to unwind the PC first (see frame.c:get_prev_frame()).  */
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
 
-  tdep->osabi = osabi;
-
   /* Register info */
   set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS);
   set_gdbarch_sp_regnum (gdbarch, VAX_SP_REGNUM);
@@ -707,27 +692,15 @@ vax_gdbarch_init (struct gdbarch_info in
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   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);
+  gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL);
 
   tm_print_insn = vax_print_insn;
 }
Index: vax-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/vax-tdep.h,v
retrieving revision 1.2
diff -u -p -r1.2 vax-tdep.h
--- vax-tdep.h	26 Jun 2002 16:07:16 -0000	1.2
+++ vax-tdep.h	4 Jan 2003 23:30:57 -0000
@@ -1,5 +1,5 @@
 /* Common target dependent code for GDB on VAX systems.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,8 +21,6 @@
 #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.  */
@@ -53,11 +51,5 @@
 #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 */



More information about the Gdb-patches mailing list