aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog102
-rw-r--r--gdb/Makefile.in73
-rw-r--r--gdb/alpha-linux-tdep.c3
-rw-r--r--gdb/alpha-osf1-tdep.c3
-rw-r--r--gdb/alpha-tdep.c34
-rw-r--r--gdb/alpha-tdep.h6
-rw-r--r--gdb/alphafbsd-tdep.c3
-rw-r--r--gdb/alphanbsd-tdep.c3
-rw-r--r--gdb/arch-utils.c3
-rw-r--r--gdb/arm-linux-tdep.c3
-rw-r--r--gdb/arm-tdep.c53
-rw-r--r--gdb/arm-tdep.h6
-rw-r--r--gdb/armnbsd-tdep.c3
-rw-r--r--gdb/defs.h33
-rw-r--r--gdb/gdbarch.c32
-rw-r--r--gdb/gdbarch.h14
-rwxr-xr-xgdb/gdbarch.sh17
-rw-r--r--gdb/hppa-tdep.c16
-rw-r--r--gdb/i386-linux-tdep.c4
-rw-r--r--gdb/i386-sol2-tdep.c1
-rw-r--r--gdb/i386-tdep.c26
-rw-r--r--gdb/i386-tdep.h7
-rw-r--r--gdb/i386bsd-tdep.c3
-rw-r--r--gdb/i386gnu-tdep.c3
-rw-r--r--gdb/i386ly-tdep.c3
-rw-r--r--gdb/i386nbsd-tdep.c3
-rw-r--r--gdb/i386obsd-tdep.c3
-rw-r--r--gdb/mips-tdep.c19
-rw-r--r--gdb/ns32k-tdep.c47
-rw-r--r--gdb/ns32k-tdep.h9
-rw-r--r--gdb/ns32knbsd-tdep.c3
-rw-r--r--gdb/osabi.c14
-rw-r--r--gdb/osabi.h36
-rw-r--r--gdb/ppc-linux-tdep.c3
-rw-r--r--gdb/ppc-tdep.h5
-rw-r--r--gdb/ppcnbsd-tdep.c3
-rw-r--r--gdb/rs6000-tdep.c13
-rw-r--r--gdb/sh-tdep.c36
-rw-r--r--gdb/sh-tdep.h5
-rw-r--r--gdb/shnbsd-tdep.c3
-rw-r--r--gdb/sparc-tdep.c50
-rw-r--r--gdb/vax-tdep.c45
-rw-r--r--gdb/vax-tdep.h10
43 files changed, 390 insertions, 371 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 99a98a1..2494c19 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,107 @@
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.
+
+2003-01-04 Daniel Jacobowitz <drow@mvista.com>
+
* breakpoint.c (insert_breakpoints): Skip disabled breakpoints
entirely.
(breakpoint_re_set_one): Don't fetch the value for a disabled
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index bf8f0d3..534a76d 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -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) $(gdb_assert_h) $(gdbthread_h) \
$(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_h) $(inferior_h) $(gdbcore_h) \
$(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_utils_h) $(gdbcmd_h) $(inferior_h) \
$(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 $(defs_h) $(inferior_h) $(gdbcore_h) \
$(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) $(symtab_h) $(symfile_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_h) $(frame_h) $(inferior_h) \
$(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) $(inferior_h) $(ppc_tdep_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) $(frame_h) $(inferior_h) $(symtab_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) $(symtab_h) $(symfile_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) $(expression_h) $(frame_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) \
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 26f4db4..1b956e8 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -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"
diff --git a/gdb/alpha-osf1-tdep.c b/gdb/alpha-osf1-tdep.c
index c170a37..9a027d4 100644
--- a/gdb/alpha-osf1-tdep.c
+++ b/gdb/alpha-osf1-tdep.c
@@ -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"
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 8db5da8..86cb625 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -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 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)
+ 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 info, struct gdbarch_list *arches)
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. */
@@ -1928,9 +1915,6 @@ alpha_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
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",
(long) tdep->vm_min_address);
diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h
index cea232b..6a75ca7 100644
--- a/gdb/alpha-tdep.h
+++ b/gdb/alpha-tdep.h
@@ -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
diff --git a/gdb/alphafbsd-tdep.c b/gdb/alphafbsd-tdep.c
index 6af3b4d..6b1b068 100644
--- a/gdb/alphafbsd-tdep.c
+++ b/gdb/alphafbsd-tdep.c
@@ -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"
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index e09b945..6137c5e 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -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"
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index de3d284..1202df9 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -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 *info)
{
memset (info, 0, sizeof (struct gdbarch_info));
info->byte_order = BFD_ENDIAN_UNKNOWN;
+ info->osabi = GDB_OSABI_UNINITIALIZED;
}
/* */
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 627ed8d..e0d8a93 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -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"
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index e43c333..4c3f7fb 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -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 info, struct gdbarch_list *arches)
{
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 info, struct gdbarch_list *arches)
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 info, struct gdbarch_list *arches)
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. */
@@ -3058,9 +3046,6 @@ arm_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
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);
}
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index a8f1514..b8c4711 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -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
diff --git a/gdb/armnbsd-tdep.c b/gdb/armnbsd-tdep.c
index 80113f5..d12fda0 100644
--- a/gdb/armnbsd-tdep.c
+++ b/gdb/armnbsd-tdep.c
@@ -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"
diff --git a/gdb/defs.h b/gdb/defs.h
index 1d980d3..0e7539a 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -977,6 +977,39 @@ extern void warning (const char *, ...) ATTR_FORMAT (printf, 1, 2);
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. */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 0a91cc6..3a44b33 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -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 *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, struct ui_file *file)
"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 *gdbarch)
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 gdbarch_list *arches,
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 info)
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);
@@ -5807,6 +5836,9 @@ gdbarch_update_p (struct gdbarch_info info)
: 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);
fprintf_unfiltered (gdb_stdlog,
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 24e6a11..edb8ade 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -95,6 +95,17 @@ extern int gdbarch_byte_order (struct gdbarch *gdbarch);
#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);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index ceca635..73f62c5 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -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 gdbarch_list *arches,
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 info)
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);
@@ -2195,6 +2209,9 @@ gdbarch_update_p (struct gdbarch_info info)
: 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);
fprintf_unfiltered (gdb_stdlog,
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 9fad7aa..0d57c0e 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -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 info, struct gdbarch_list *arches)
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);
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 1ef14fc..c7bd36a 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -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.
@@ -34,6 +34,8 @@
#include "solib-svr4.h" /* For struct link_map_offsets. */
+#include "osabi.h"
+
#include "i386-tdep.h"
#include "i386-linux-tdep.h"
diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c
index f58c455..a52b188 100644
--- a/gdb/i386-sol2-tdep.c
+++ b/gdb/i386-sol2-tdep.c
@@ -20,6 +20,7 @@
#include "defs.h"
#include "value.h"
+#include "osabi.h"
#include "i386-tdep.h"
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 2654396..9c1000e 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -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 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'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 info, struct gdbarch_list *arches)
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 info, struct gdbarch_list *arches)
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;
}
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 627cb0a..25bf6b3 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -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;
diff --git a/gdb/i386bsd-tdep.c b/gdb/i386bsd-tdep.c
index 77a4eec..af30df1 100644
--- a/gdb/i386bsd-tdep.c
+++ b/gdb/i386bsd-tdep.c
@@ -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"
diff --git a/gdb/i386gnu-tdep.c b/gdb/i386gnu-tdep.c
index 143ddc0..297d566 100644
--- a/gdb/i386gnu-tdep.c
+++ b/gdb/i386gnu-tdep.c
@@ -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"
diff --git a/gdb/i386ly-tdep.c b/gdb/i386ly-tdep.c
index 22bab3a..d0775b7 100644
--- a/gdb/i386ly-tdep.c
+++ b/gdb/i386ly-tdep.c
@@ -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"
diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c
index 69283f8..64b3dc0 100644
--- a/gdb/i386nbsd-tdep.c
+++ b/gdb/i386nbsd-tdep.c
@@ -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"
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index 8bbce84..be0c674 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -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"
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index d618e53..2f24ec0 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -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 info,
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 info,
/* 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 info,
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 info,
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 info,
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_gdbarch, struct ui_file *file)
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
diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c
index 8c2db2e..4b3b937 100644
--- a/gdb/ns32k-tdep.c
+++ b/gdb/ns32k-tdep.c
@@ -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 *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 info, struct gdbarch_list *arches)
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;
}
diff --git a/gdb/ns32k-tdep.h b/gdb/ns32k-tdep.h
index c046324..c2dc71a 100644
--- a/gdb/ns32k-tdep.h
+++ b/gdb/ns32k-tdep.h
@@ -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,
@@ -55,11 +53,6 @@
#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 *);
diff --git a/gdb/ns32knbsd-tdep.c b/gdb/ns32knbsd-tdep.c
index ad360c8..33b99d9 100644
--- a/gdb/ns32knbsd-tdep.c
+++ b/gdb/ns32knbsd-tdep.c
@@ -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"
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 47d08a2..d856bea 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -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 info, struct gdbarch *gdbarch,
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 info, struct gdbarch *gdbarch,
"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));
}
diff --git a/gdb/osabi.h b/gdb/osabi.h
index ebff831..d0e33b3 100644
--- a/gdb/osabi.h
+++ b/gdb/osabi.h
@@ -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_architecture, unsigned long,
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);
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 0f6699e..c118cf4 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -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"
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index 48c5647..cf81eb9 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -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 */
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index e58bb6a..ba863d0 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -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"
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index d03d36d..d0a3c03 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -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 info, struct gdbarch_list *arches)
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 info, struct gdbarch_list *arches)
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 info, struct gdbarch_list *arches)
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 info, struct gdbarch_list *arches)
}
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 info, struct gdbarch_list *arches)
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 *current_gdbarch, struct ui_file *file)
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;
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 741f3f5..e0088d1 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -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 info, struct gdbarch_list *arches)
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 info, struct gdbarch_list *arches)
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 info, struct gdbarch_list *arches)
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_gdbarch, struct ui_file *file)
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
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index cd7f35a..1b9c8fe 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -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;
};
diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c
index d2f042a..f915d2a 100644
--- a/gdb/shnbsd-tdep.c
+++ b/gdb/shnbsd-tdep.c
@@ -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"
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 7e8bcca..2c7c5dd 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -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 info, struct gdbarch_list *arches)
{
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 info, struct gdbarch_list *arches)
/* 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 info, struct gdbarch_list *arches)
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 info, struct gdbarch_list *arches)
}
/* 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_gdbarch, struct ui_file *file)
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);
}
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index c467e13..1d1b83a 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -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 *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;
- /* 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 info, struct gdbarch_list *arches)
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;
}
diff --git a/gdb/vax-tdep.h b/gdb/vax-tdep.h
index ccabdd5..7529e57 100644
--- a/gdb/vax-tdep.h
+++ b/gdb/vax-tdep.h
@@ -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. */
@@ -54,10 +52,4 @@
#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 */