From 4be87837a23001df36ca5a4171eb01dec22856e1 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Sat, 4 Jan 2003 23:38:46 +0000 Subject: * 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. Plus updates to alpha, arm, hppa, i386, mips, ns32k, ppc, sh, sparc, and vax ports to match. --- gdb/ns32k-tdep.c | 47 +++++++++-------------------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) (limited to 'gdb/ns32k-tdep.c') 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; } -- cgit v1.1