[RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names)

Pedro Alves
2016-03-09T01:34:45Z

On 03/07/2016 07:12 PM, Simon Marchi wrote:
> On 16-03-07 02:02 PM, Pedro Alves wrote:
>> It's not possible today to select some of the osabis by name.
>> Specifically, those that have spaces in their names and then the first
>> word is ambiguous...
>>
>> For example:
>> (gdb) set osabi <TAB>
>> AIX
>> Cygwin
>> DICOS
>> DJGPP
>> Darwin
>> FreeBSD ELF
>> FreeBSD a.out
>> GNU/Hurd
>> GNU/Linux
>> LynxOS178
>> NetBSD ELF
>> NetBSD a.out
>> Newlib
>> OpenBSD ELF
>> OpenVMS
>> QNX Neutrino
>> SDE
>> SVR4
>> Solaris
>> Symbian
>> Windows CE
>> auto
>> default
>> none
>> (gdb) set osabi FreeBSD ELF
>> Ambiguous item "FreeBSD ELF".
>>
>> In reality, because "set osabi" is an enum command, that was
>> equivalent to trying "set osabi FreeBSD", which is then obviously
>> ambiguous, because of "FreeBSD ELF" and "FreeBSD a.out".
>>
>> Also, even if the first word is not ambiguous, we actually ignore
>> whatever comes after the first word:
>>
>> (gdb) set osabi GNU/Linux
>> (gdb) show osabi
>> The current OS ABI is "GNU/Linux".
>> The default OS ABI is "GNU/Linux".
>> (gdb) set osabi Windows SomeNonsense
>> ^^^^^^^^^^^^
>> (gdb) show osabi
>> The current OS ABI is "Windows CE".
>> The default OS ABI is "GNU/Linux".
>> (gdb)
>>
>> Fix this by avoiding spaces in osabi names.
>>
>> We could instead make "set osabi" have a custom set hook, or
>> alternatively make the enum set hook (in cli-setshow.c) handle values
>> with spaces, but OTOH, I have a feeling that could cause trouble.
>> E.g., in cases where we might want to write more than one enum value
>> in the same line. We could support quoting as workaround, but, do we
>> want that? "No spaces" seems simpler.
>>
>> I'm thinking that if we take this route, we should probably make the
>> enum command registration functions assert that no possible enum value
>> contains spaces. I tried that, and other than the "set architecture"
>> command, I found no other case. I sent a patch to binutils@ to try to
>> fix that one.
>>
>> gdb/ChangeLog:
>> 2016-03-07 Pedro Alves <palves@redhat.com>
>>
>> * osabi.c (gdb_osabi_names): Avoid spaces in osabi names.
>> ---
>> gdb/osabi.c | 18 +++++++++---------
>> 1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/gdb/osabi.c b/gdb/osabi.c
>> index e8a77ab..f7d4e74 100644
>> --- a/gdb/osabi.c
>> +++ b/gdb/osabi.c
>> @@ -64,17 +64,17 @@ static const struct osabi_names gdb_osabi_names[] =
>> { "GNU/Hurd", NULL },
>> { "Solaris", NULL },
>> { "GNU/Linux", "linux(-gnu)?" },
>> - { "FreeBSD a.out", NULL },
>> - { "FreeBSD ELF", NULL },
>> - { "NetBSD a.out", NULL },
>> - { "NetBSD ELF", NULL },
>> - { "OpenBSD ELF", NULL },
>> - { "Windows CE", NULL },
>> + { "FreeBSD/a.out", NULL },
>> + { "FreeBSD/ELF", NULL },
>> + { "NetBSD/a.out", NULL },
>> + { "NetBSD/ELF", NULL },
>> + { "OpenBSD/ELF", NULL },
>> + { "WindowsCE", NULL },
>> { "DJGPP", NULL },
>> { "Irix", NULL },
>> - { "HP/UX ELF", NULL },
>> - { "HP/UX SOM", NULL },
>> - { "QNX Neutrino", NULL },
>> + { "HP-UX/ELF", NULL },
>> + { "HP-UX/SOM", NULL },
>
> We nuked hp-ux some time ago. Is that some leftover?

Yeah. We have some left over bits that reference it, but I think
we can get rid of them.

I think we can get rid of everything a.out too. We removed most
support for a.out BSD targets a while ago, but AFAICS, some of the
a.out support is still in place for debugging BSD core dumps in
a.out format. I found some left over SunOS a.out support too, which
we no longer support either.

It is my understanding that OpenBSD switched to ELF core dumps
several years ago. NetBSD's core man page talks about ELF-format
core dumps too.

Mark, do you know whether there's any reason we should keep a.out
support longer?

Below's a preliminary patch, to show what I'm talking about. With this,
we could simplify the OS ABI names, like in the patch:

- { "FreeBSD a.out", NULL },
- { "FreeBSD ELF", NULL },
- { "NetBSD a.out", NULL },
- { "NetBSD ELF", NULL },
- { "OpenBSD ELF", NULL },
+ { "FreeBSD", NULL },
+ { "NetBSD", NULL },
+ { "OpenBSD", NULL },

No regressions on x86-64 Fedora 23, but that doesn't prove that much.

From 5a9a598f1ff80c1b6b7add727a569af01246f144 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Wed, 9 Mar 2016 01:10:56 +0000
Subject: [PATCH] remove obsolete osabis

---
gdb/Makefile.in | 2 +-
gdb/alphanbsd-tdep.c | 20 +-----
gdb/amd64obsd-tdep.c | 53 --------------
gdb/arm-tdep.c | 5 --
gdb/armnbsd-nat.c | 29 --------
gdb/armnbsd-tdep.c | 25 -------
gdb/armobsd-tdep.c | 13 ----
gdb/breakpoint.c | 8 ---
gdb/configure.tgt | 4 +-
gdb/dbxread.c | 200 ++-------------------------------------------------
gdb/defs.h | 4 --
gdb/hppa-tdep.c | 23 ------
gdb/hppaobsd-tdep.c | 18 -----
gdb/i386bsd-tdep.c | 35 ---------
gdb/i386fbsd-tdep.c | 14 +---
gdb/i386obsd-tdep.c | 71 +-----------------
gdb/m68kbsd-tdep.c | 109 +---------------------------
gdb/osabi.c | 26 +++----
gdb/ppcobsd-tdep.c | 18 -----
gdb/rs6000-tdep.c | 1 -
gdb/shnbsd-tdep.c | 17 -----
gdb/solib.c | 24 +------
gdb/sparc-tdep.h | 4 +-
gdb/sparcnbsd-tdep.c | 56 +--------------
gdb/sparcobsd-tdep.c | 2 +-
gdb/stabsread.c | 9 +--
gdb/symmisc.c | 2 +-
gdb/vaxobsd-tdep.c | 149 --------------------------------------
28 files changed, 37 insertions(+), 904 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 602ef43..bfdf660 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -707,7 +707,7 @@ ALL_TARGET_OBS = \
tic6x-tdep.o tic6x-linux-tdep.o \
tilegx-tdep.o tilegx-linux-tdep.o \
v850-tdep.o \
- vaxnbsd-tdep.o vaxobsd-tdep.o vax-tdep.o \
+ vaxnbsd-tdep.o vax-tdep.o \
xstormy16-tdep.o \
xtensa-config.o xtensa-tdep.o xtensa-linux-tdep.o \
glibc-tdep.o \
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index abe3926..140cb96 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -35,9 +35,6 @@

/* Core file support. */

-/* Even though NetBSD/alpha used ELF since day one, it used the
- traditional a.out-style core dump format before NetBSD 1.6. */
-
/* Sizeof `struct reg' in <machine/reg.h>. */
#define ALPHANBSD_SIZEOF_GREGS (32 * 8)

@@ -279,26 +276,15 @@ alphanbsd_init_abi (struct gdbarch_info info,
}
\f

-static enum gdb_osabi
-alphanbsd_core_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
- return GDB_OSABI_NETBSD_ELF;
-
- return GDB_OSABI_UNKNOWN;
-}
-\f
-
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_alphanbsd_tdep (void);

void
_initialize_alphanbsd_tdep (void)
{
- /* BFD doesn't set a flavour for NetBSD style a.out core files. */
- gdbarch_register_osabi_sniffer (bfd_arch_alpha, bfd_target_unknown_flavour,
- alphanbsd_core_osabi_sniffer);
-
+ /* Even though NetBSD/alpha used ELF since day one, it used the
+ traditional a.out-style core dump format before NetBSD 1.6, but
+ we don't support those. */
gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_NETBSD_ELF,
alphanbsd_init_abi);
}
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index 7c79e44..1f6da52 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -35,44 +35,6 @@
#include "solib-svr4.h"
#include "bsd-uthread.h"

-/* Support for core dumps. */
-
-static void
-amd64obsd_supply_regset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *regs, size_t len)
-{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
-
- i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
- amd64_supply_fxsave (regcache, regnum,
- ((const gdb_byte *)regs) + tdep->sizeof_gregset);
-}
-
-static const struct regset amd64obsd_combined_regset =
- {
- NULL, amd64obsd_supply_regset, NULL
- };
-
-static void
-amd64obsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
- iterate_over_regset_sections_cb *cb,
- void *cb_data,
- const struct regcache *regcache)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- /* OpenBSD core dumps don't use seperate register sets for the
- general-purpose and floating-point registers. */
-
- cb (".reg", tdep->sizeof_gregset + I387_SIZEOF_FXSAVE,
- &amd64obsd_combined_regset, NULL, cb_data);
-}
-\f
-
/* Support for signal handlers. */

/* Default page size. */
@@ -483,17 +445,6 @@ amd64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Unwind kernel trap frames correctly. */
frame_unwind_prepend_unwinder (gdbarch, &amd64obsd_trapframe_unwind);
}
-
-/* Traditional (a.out) NetBSD-style core dumps. */
-
-static void
-amd64obsd_core_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- amd64obsd_init_abi (info, gdbarch);
-
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, amd64obsd_iterate_over_regset_sections);
-}
\f

/* Provide a prototype to silence -Wmissing-prototypes. */
@@ -507,8 +458,4 @@ _initialize_amd64obsd_tdep (void)

gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
GDB_OSABI_OPENBSD_ELF, amd64obsd_init_abi);
-
- /* OpenBSD uses traditional (a.out) NetBSD-style core dumps. */
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_NETBSD_AOUT, amd64obsd_core_init_abi);
}
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 54a21ef..f6bcc0d 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -8786,11 +8786,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)

switch (bfd_get_flavour (info.abfd))
{
- case bfd_target_aout_flavour:
- /* Assume it's an old APCS-style ABI. */
- arm_abi = ARM_ABI_APCS;
- break;
-
case bfd_target_coff_flavour:
/* Assume it's an old APCS-style ABI. */
/* XXX WinCE? */
diff --git a/gdb/armnbsd-nat.c b/gdb/armnbsd-nat.c
index c8b549e..f9fd7be 100644
--- a/gdb/armnbsd-nat.c
+++ b/gdb/armnbsd-nat.c
@@ -409,25 +409,6 @@ armnbsd_store_registers (struct target_ops *ops,
}
}

-struct md_core
-{
- struct reg intreg;
- struct fpreg freg;
-};
-
-static void
-fetch_core_registers (struct regcache *regcache,
- char *core_reg_sect, unsigned core_reg_size,
- int which, CORE_ADDR ignore)
-{
- struct md_core *core_reg = (struct md_core *) core_reg_sect;
- int regno;
- CORE_ADDR r_pc;
-
- arm_supply_gregset (regcache, &core_reg->intreg);
- arm_supply_fparegset (regcache, &core_reg->freg);
-}
-
static void
fetch_elfcore_registers (struct regcache *regcache,
char *core_reg_sect, unsigned core_reg_size,
@@ -468,15 +449,6 @@ fetch_elfcore_registers (struct regcache *regcache,
}
}

-static struct core_fns arm_netbsd_core_fns =
-{
- bfd_target_unknown_flavour, /* core_flovour. */
- default_check_format, /* check_format. */
- default_core_sniffer, /* core_sniffer. */
- fetch_core_registers, /* core_read_registers. */
- NULL
-};
-
static struct core_fns arm_netbsd_elfcore_fns =
{
bfd_target_elf_flavour, /* core_flovour. */
@@ -496,6 +468,5 @@ _initialize_arm_netbsd_nat (void)
t->to_store_registers = armnbsd_store_registers;
add_target (t);

- deprecated_add_core_fns (&arm_netbsd_core_fns);
deprecated_add_core_fns (&arm_netbsd_elfcore_fns);
}
diff --git a/gdb/armnbsd-tdep.c b/gdb/armnbsd-tdep.c
index 259853c..1d099fc 100644
--- a/gdb/armnbsd-tdep.c
+++ b/gdb/armnbsd-tdep.c
@@ -71,17 +71,6 @@ arm_netbsd_init_abi_common (struct gdbarch_info info,
}

static void
-arm_netbsd_aout_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- arm_netbsd_init_abi_common (info, gdbarch);
- if (tdep->fp_model == ARM_FLOAT_AUTO)
- tdep->fp_model = ARM_FLOAT_SOFT_FPA;
-}
-
-static void
arm_netbsd_elf_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
@@ -96,26 +85,12 @@ arm_netbsd_elf_init_abi (struct gdbarch_info info,
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
}

-static enum gdb_osabi
-arm_netbsd_aout_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0)
- return GDB_OSABI_NETBSD_AOUT;
-
- return GDB_OSABI_UNKNOWN;
-}
-
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_arm_netbsd_tdep;

void
_initialize_arm_netbsd_tdep (void)
{
- gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour,
- arm_netbsd_aout_osabi_sniffer);
-
- gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT,
- arm_netbsd_aout_init_abi);
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF,
arm_netbsd_elf_init_abi);
}
diff --git a/gdb/armobsd-tdep.c b/gdb/armobsd-tdep.c
index 5ccf1d1..652046f 100644
--- a/gdb/armobsd-tdep.c
+++ b/gdb/armobsd-tdep.c
@@ -116,25 +116,12 @@ armobsd_init_abi (struct gdbarch_info info,
}
\f

-static enum gdb_osabi
-armobsd_core_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
- return GDB_OSABI_OPENBSD_ELF;
-
- return GDB_OSABI_UNKNOWN;
-}
-
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_armobsd_tdep;

void
_initialize_armobsd_tdep (void)
{
- /* BFD doesn't set a flavour for NetBSD style a.out core files. */
- gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_unknown_flavour,
- armobsd_core_osabi_sniffer);
-
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_OPENBSD_ELF,
armobsd_init_abi);
}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index f99a7ab..ff22dcd 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7932,14 +7932,6 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
struct bp_location *loc, **locp_tmp;
int disabled_shlib_breaks = 0;

- /* SunOS a.out shared libraries are always mapped, so do not
- disable breakpoints; they will only be reported as unloaded
- through clear_solib when GDB discards its shared library
- list. See clear_solib for more information. */
- if (exec_bfd != NULL
- && bfd_get_flavour (exec_bfd) == bfd_target_aout_flavour)
- return;
-
ALL_BP_LOCATIONS (loc, locp_tmp)
{
/* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index c2b9c40..0d30e3b 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -627,11 +627,11 @@ v850*-*-elf | v850*-*-rtems*)

vax-*-netbsd* | vax-*-knetbsd*-gnu)
# Target: NetBSD/vax
- gdb_target_obs="vax-tdep.o vaxnbsd-tdep.o solib-svr4.o"
+ gdb_target_obs="vax-tdep.o solib-svr4.o"
;;
vax-*-openbsd*)
# Target: OpenBSD/vax
- gdb_target_obs="vax-tdep.o vaxobsd-tdep.o"
+ gdb_target_obs="vax-tdep.o"
;;
vax-*-*)
# Target: VAX
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 5ee7315..713ae59 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -144,10 +144,6 @@ static unsigned int next_file_string_table_offset;

static int symfile_relocatable = 0;

-/* If this is nonzero, N_LBRAC, N_RBRAC, and N_SLINE entries are
- relative to the function start address. */
-
-static int block_address_function_relative = 0;
\f
/* The lowest text address we have yet encountered. This is needed
because in an a.out file, there is no header field which tells us
@@ -262,8 +258,6 @@ static void dbx_read_symtab (struct partial_symtab *self,

static void dbx_psymtab_to_symtab_1 (struct objfile *, struct partial_symtab *);

-static void read_dbx_dynamic_symtab (struct objfile *objfile);
-
static void read_dbx_symtab (struct objfile *);

static void free_bincl_list (struct objfile *);
@@ -532,18 +526,6 @@ dbx_symfile_read (struct objfile *objfile, int symfile_flags)

symfile_relocatable = bfd_get_file_flags (sym_bfd) & HAS_RELOC;

- /* This is true for Solaris (and all other systems which put stabs
- in sections, hopefully, since it would be silly to do things
- differently from Solaris), and false for SunOS4 and other a.out
- file formats. */
- block_address_function_relative =
- ((startswith (bfd_get_target (sym_bfd), "elf"))
- || (startswith (bfd_get_target (sym_bfd), "som"))
- || (startswith (bfd_get_target (sym_bfd), "coff"))
- || (startswith (bfd_get_target (sym_bfd), "pe"))
- || (startswith (bfd_get_target (sym_bfd), "epoc-pe"))
- || (startswith (bfd_get_target (sym_bfd), "nlm")));
-
val = bfd_seek (sym_bfd, DBX_SYMTAB_OFFSET (objfile), SEEK_SET);
if (val < 0)
perror_with_name (objfile_name (objfile));
@@ -565,10 +547,6 @@ dbx_symfile_read (struct objfile *objfile, int symfile_flags)

read_dbx_symtab (objfile);

- /* Add the dynamic symbols. */
-
- read_dbx_dynamic_symtab (objfile);
-
/* Install any minimal symbols that have been collected as the current
minimal symbols for this objfile. */

@@ -975,144 +953,6 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
return namestring;
}

-/* Scan a SunOs dynamic symbol table for symbols of interest and
- add them to the minimal symbol table. */
-
-static void
-read_dbx_dynamic_symtab (struct objfile *objfile)
-{
- bfd *abfd = objfile->obfd;
- struct cleanup *back_to;
- int counter;
- long dynsym_size;
- long dynsym_count;
- asymbol **dynsyms;
- asymbol **symptr;
- arelent **relptr;
- long dynrel_size;
- long dynrel_count;
- arelent **dynrels;
- CORE_ADDR sym_value;
- const char *name;
-
- /* Check that the symbol file has dynamic symbols that we know about.
- bfd_arch_unknown can happen if we are reading a sun3 symbol file
- on a sun4 host (and vice versa) and bfd is not configured
- --with-target=all. This would trigger an assertion in bfd/sunos.c,
- so we ignore the dynamic symbols in this case. */
- if (bfd_get_flavour (abfd) != bfd_target_aout_flavour
- || (bfd_get_file_flags (abfd) & DYNAMIC) == 0
- || bfd_get_arch (abfd) == bfd_arch_unknown)
- return;
-
- dynsym_size = bfd_get_dynamic_symtab_upper_bound (abfd);
- if (dynsym_size < 0)
- return;
-
- dynsyms = (asymbol **) xmalloc (dynsym_size);
- back_to = make_cleanup (xfree, dynsyms);
-
- dynsym_count = bfd_canonicalize_dynamic_symtab (abfd, dynsyms);
- if (dynsym_count < 0)
- {
- do_cleanups (back_to);
- return;
- }
-
- /* Enter dynamic symbols into the minimal symbol table
- if this is a stripped executable. */
- if (bfd_get_symcount (abfd) <= 0)
- {
- symptr = dynsyms;
- for (counter = 0; counter < dynsym_count; counter++, symptr++)
- {
- asymbol *sym = *symptr;
- asection *sec;
- int type;
-
- sec = bfd_get_section (sym);
-
- /* BFD symbols are section relative. */
- sym_value = sym->value + sec->vma;
-
- if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
- {
- type = N_TEXT;
- }
- else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
- {
- type = N_DATA;
- }
- else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
- {
- type = N_BSS;
- }
- else
- continue;
-
- if (sym->flags & BSF_GLOBAL)
- type |= N_EXT;
-
- record_minimal_symbol (bfd_asymbol_name (sym), sym_value,
- type, objfile);
- }
- }
-
- /* Symbols from shared libraries have a dynamic relocation entry
- that points to the associated slot in the procedure linkage table.
- We make a mininal symbol table entry with type mst_solib_trampoline
- at the address in the procedure linkage table. */
- dynrel_size = bfd_get_dynamic_reloc_upper_bound (abfd);
- if (dynrel_size < 0)
- {
- do_cleanups (back_to);
- return;
- }
-
- dynrels = (arelent **) xmalloc (dynrel_size);
- make_cleanup (xfree, dynrels);
-
- dynrel_count = bfd_canonicalize_dynamic_reloc (abfd, dynrels, dynsyms);
- if (dynrel_count < 0)
- {
- do_cleanups (back_to);
- return;
- }
-
- for (counter = 0, relptr = dynrels;
- counter < dynrel_count;
- counter++, relptr++)
- {
- arelent *rel = *relptr;
- CORE_ADDR address = rel->address;
-
- switch (bfd_get_arch (abfd))
- {
- case bfd_arch_sparc:
- if (rel->howto->type != RELOC_JMP_SLOT)
- continue;
- break;
- case bfd_arch_m68k:
- /* `16' is the type BFD produces for a jump table relocation. */
- if (rel->howto->type != 16)
- continue;
-
- /* Adjust address in the jump table to point to
- the start of the bsr instruction. */
- address -= 2;
- break;
- default:
- continue;
- }
-
- name = bfd_asymbol_name (*rel->sym_ptr_ptr);
- prim_record_minimal_symbol (name, address, mst_solib_trampoline,
- objfile);
- }
-
- do_cleanups (back_to);
-}
-
static CORE_ADDR
find_stab_function_addr (char *namestring, const char *filename,
struct objfile *objfile)
@@ -2699,14 +2539,6 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
N_STSYM or N_GSYM for SunOS4 acc; N_FUN for other compilers. */
static int function_stab_type = 0;

- if (!block_address_function_relative)
- {
- /* N_LBRAC, N_RBRAC and N_SLINE entries are not relative to the
- function start address, so just use the text offset. */
- function_start_offset =
- ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
- }
-
/* Something is wrong if we see real data before seeing a source
file name. */

@@ -2762,8 +2594,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,

/* May be switching to an assembler file which may not be using
block relative stabs, so reset the offset. */
- if (block_address_function_relative)
- function_start_offset = 0;
+ function_start_offset = 0;

break;
}
@@ -2785,13 +2616,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
if (n_opt_found && desc == 1)
break;

- if (block_address_function_relative)
- /* Relocate for Sun ELF acc fn-relative syms. */
- valu += function_start_offset;
- else
- /* On most machines, the block addresses are relative to the
- N_SO, the linker did not relocate them (sigh). */
- valu += last_source_start_addr;
+ valu += function_start_offset;

push_context (desc, valu);
break;
@@ -2804,13 +2629,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
if (n_opt_found && desc == 1)
break;

- if (block_address_function_relative)
- /* Relocate for Sun ELF acc fn-relative syms. */
- valu += function_start_offset;
- else
- /* On most machines, the block addresses are relative to the
- N_SO, the linker did not relocate them (sigh). */
- valu += last_source_start_addr;
+ valu += function_start_offset;

if (context_stack_depth <= 0)
{
@@ -2905,8 +2724,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
if (*name == '\000')
break;

- if (block_address_function_relative)
- function_start_offset = 0;
+ function_start_offset = 0;

start_stabs ();
start_symtab (objfile, name, NULL, valu);
@@ -3126,14 +2944,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
valu = minsym_valu;
}

- if (block_address_function_relative)
- /* For Solaris 2 compilers, the block addresses and
- N_SLINE's are relative to the start of the
- function. On normal systems, and when using GCC on
- Solaris 2, these addresses are just absolute, or
- relative to the N_SO, depending on
- BLOCK_ADDRESS_ABSOLUTE. */
- function_start_offset = valu;
+ /* These addresses are absolute. */
+ function_start_offset = valu;

within_function = 1;

diff --git a/gdb/defs.h b/gdb/defs.h
index f6ffeac..4a6ee52 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -552,16 +552,12 @@ enum gdb_osabi
GDB_OSABI_HURD,
GDB_OSABI_SOLARIS,
GDB_OSABI_LINUX,
- GDB_OSABI_FREEBSD_AOUT,
GDB_OSABI_FREEBSD_ELF,
- GDB_OSABI_NETBSD_AOUT,
GDB_OSABI_NETBSD_ELF,
GDB_OSABI_OPENBSD_ELF,
GDB_OSABI_WINCE,
GDB_OSABI_GO32,
GDB_OSABI_IRIX,
- GDB_OSABI_HPUX_ELF,
- GDB_OSABI_HPUX_SOM,
GDB_OSABI_QNXNTO,
GDB_OSABI_CYGWIN,
GDB_OSABI_AIX,
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index ac507e7..bd8fd8c 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2462,21 +2462,6 @@ hppa_stub_frame_unwind_cache (struct frame_info *this_frame,

info->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);

- if (gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_SOM)
- {
- /* HPUX uses export stubs in function calls; the export stub clobbers
- the return value of the caller, and, later restores it from the
- stack. */
- u = find_unwind_entry (get_frame_pc (this_frame));
-
- if (u && u->stub_unwind.stub_type == EXPORT)
- {
- info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr = info->base - 24;
-
- return info;
- }
- }
-
/* By default we assume that stubs do not change the rp. */
info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;

@@ -3070,14 +3055,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
-
- /* Try to determine the ABI of the object we are loading. */
- if (info.abfd != NULL && info.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)
- info.osabi = GDB_OSABI_HPUX_SOM;
- }

/* find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
diff --git a/gdb/hppaobsd-tdep.c b/gdb/hppaobsd-tdep.c
index 28f5d2f..076f6aa 100644
--- a/gdb/hppaobsd-tdep.c
+++ b/gdb/hppaobsd-tdep.c
@@ -167,30 +167,12 @@ hppaobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
\f

-/* OpenBSD uses uses the traditional NetBSD core file format, even for
- ports that use ELF. */
-#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF
-
-static enum gdb_osabi
-hppaobsd_core_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
- return GDB_OSABI_NETBSD_CORE;
-
- return GDB_OSABI_UNKNOWN;
-}
-\f
-
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_hppabsd_tdep (void);

void
_initialize_hppabsd_tdep (void)
{
- /* BFD doesn't set a flavour for NetBSD style a.out core files. */
- gdbarch_register_osabi_sniffer (bfd_arch_hppa, bfd_target_unknown_flavour,
- hppaobsd_core_osabi_sniffer);
-
gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_OPENBSD_ELF,
hppaobsd_init_abi);
}
diff --git a/gdb/i386bsd-tdep.c b/gdb/i386bsd-tdep.c
index 15809b3..af4b830 100644
--- a/gdb/i386bsd-tdep.c
+++ b/gdb/i386bsd-tdep.c
@@ -86,38 +86,3 @@ i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}

\f
-static enum gdb_osabi
-i386bsd_aout_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "a.out-i386-netbsd") == 0)
- return GDB_OSABI_NETBSD_AOUT;
-
- if (strcmp (bfd_get_target (abfd), "a.out-i386-freebsd") == 0)
- return GDB_OSABI_FREEBSD_AOUT;
-
- return GDB_OSABI_UNKNOWN;
-}
-
-static enum gdb_osabi
-i386bsd_core_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
- return GDB_OSABI_NETBSD_AOUT;
-
- return GDB_OSABI_UNKNOWN;
-}
-
-\f
-/* Provide a prototype to silence -Wmissing-prototypes. */
-void _initialize_i386bsd_tdep (void);
-
-void
-_initialize_i386bsd_tdep (void)
-{
- gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour,
- i386bsd_aout_osabi_sniffer);
-
- /* BFD doesn't set a flavour for NetBSD style a.out core files. */
- gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_unknown_flavour,
- i386bsd_core_osabi_sniffer);
-}
diff --git a/gdb/i386fbsd-tdep.c b/gdb/i386fbsd-tdep.c
index fbff37c..6217387 100644
--- a/gdb/i386fbsd-tdep.c
+++ b/gdb/i386fbsd-tdep.c
@@ -373,7 +373,7 @@ i386fbsd_collect_uthread (const struct regcache *regcache,
}

static void
-i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);

@@ -403,18 +403,10 @@ i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* FreeBSD provides a user-level threads implementation. */
bsd_uthread_set_supply_uthread (gdbarch, i386fbsd_supply_uthread);
bsd_uthread_set_collect_uthread (gdbarch, i386fbsd_collect_uthread);
-}
-
-static void
-i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- /* It's almost identical to FreeBSD a.out. */
- i386fbsdaout_init_abi (info, gdbarch);

- /* Except that it uses ELF. */
i386_elf_init_abi (info, gdbarch);

- /* FreeBSD ELF uses SVR4-style shared libraries. */
+ /* FreeBSD uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
}
@@ -491,8 +483,6 @@ void _initialize_i386fbsd_tdep (void);
void
_initialize_i386fbsd_tdep (void)
{
- gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_FREEBSD_AOUT,
- i386fbsdaout_init_abi);
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_FREEBSD_ELF,
i386fbsd4_init_abi);
}
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index 1bdc5d6..a418891 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -134,40 +134,6 @@ static int i386obsd_r_reg_offset[] =
15 * 4 /* %gs */
};

-static void
-i386obsd_aout_supply_regset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *regs, size_t len)
-{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- const gdb_byte *gregs = (const gdb_byte *) regs;
-
- gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
-
- i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
- i387_supply_fsave (regcache, regnum, gregs + tdep->sizeof_gregset);
-}
-
-static const struct regset i386obsd_aout_gregset =
- {
- NULL, i386obsd_aout_supply_regset, NULL
- };
-
-static void
-i386obsd_aout_iterate_over_regset_sections (struct gdbarch *gdbarch,
- iterate_over_regset_sections_cb *cb,
- void *cb_data,
- const struct regcache *regcache)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- /* OpenBSD a.out core dumps don't use seperate register sets for the
- general-purpose and floating-point registers. */
-
- cb (".reg", tdep->sizeof_gregset + I387_SIZEOF_FSAVE,
- &i386obsd_aout_gregset, NULL, cb_data);
-}
\f

/* Sigtramp routine location for OpenBSD 3.1 and earlier releases. */
@@ -445,6 +411,7 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Obviously OpenBSD is BSD-based. */
i386bsd_init_abi (info, gdbarch);
obsd_init_abi (info, gdbarch);
+ i386_elf_init_abi (info, gdbarch);

/* OpenBSD has a different `struct reg'. */
tdep->gregset_reg_offset = i386obsd_r_reg_offset;
@@ -470,32 +437,6 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)

/* Unwind kernel trap frames correctly. */
frame_unwind_prepend_unwinder (gdbarch, &i386obsd_trapframe_unwind);
-}
-
-/* OpenBSD a.out. */
-
-static void
-i386obsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- i386obsd_init_abi (info, gdbarch);
-
- /* OpenBSD a.out has a single register set. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, i386obsd_aout_iterate_over_regset_sections);
-}
-
-/* OpenBSD ELF. */
-
-static void
-i386obsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- /* It's still OpenBSD. */
- i386obsd_init_abi (info, gdbarch);
-
- /* But ELF-based. */
- i386_elf_init_abi (info, gdbarch);

/* OpenBSD ELF uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
@@ -509,14 +450,6 @@ void _initialize_i386obsd_tdep (void);
void
_initialize_i386obsd_tdep (void)
{
- /* FIXME: kettenis/20021020: Since OpenBSD/i386 binaries are
- indistingushable from NetBSD/i386 a.out binaries, building a GDB
- that should support both these targets will probably not work as
- expected. */
-#define GDB_OSABI_OPENBSD_AOUT GDB_OSABI_NETBSD_AOUT
-
- gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_OPENBSD_AOUT,
- i386obsd_aout_init_abi);
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_OPENBSD_ELF,
- i386obsd_elf_init_abi);
+ i386obsd_init_abi);
}
diff --git a/gdb/m68kbsd-tdep.c b/gdb/m68kbsd-tdep.c
index 0d2a4e9..1d32bd3 100644
--- a/gdb/m68kbsd-tdep.c
+++ b/gdb/m68kbsd-tdep.c
@@ -129,60 +129,6 @@ m68kbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
}
\f

-/* Signal trampolines. */
-
-static void
-m68kobsd_sigtramp_cache_init (const struct tramp_frame *self,
- struct frame_info *this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
-{
- CORE_ADDR addr, base, pc;
- int regnum;
-
- base = get_frame_register_unsigned (this_frame, M68K_SP_REGNUM);
-
- /* The 'addql #4,%sp' instruction at offset 8 adjusts the stack
- pointer. Adjust the frame base accordingly. */
- pc = get_frame_register_unsigned (this_frame, M68K_PC_REGNUM);
- if ((pc - func) > 8)
- base -= 4;
-
- /* Get frame pointer, stack pointer, program counter and processor
- state from `struct sigcontext'. */
- addr = get_frame_memory_unsigned (this_frame, base + 8, 4);
- trad_frame_set_reg_addr (this_cache, M68K_FP_REGNUM, addr + 8);
- trad_frame_set_reg_addr (this_cache, M68K_SP_REGNUM, addr + 12);
- trad_frame_set_reg_addr (this_cache, M68K_PC_REGNUM, addr + 20);
- trad_frame_set_reg_addr (this_cache, M68K_PS_REGNUM, addr + 24);
-
- /* The sc_ap member of `struct sigcontext' points to additional
- hardware state. Here we find the missing registers. */
- addr = get_frame_memory_unsigned (this_frame, addr + 16, 4) + 4;
- for (regnum = M68K_D0_REGNUM; regnum < M68K_FP_REGNUM; regnum++, addr += 4)
- trad_frame_set_reg_addr (this_cache, regnum, addr);
-
- /* Construct the frame ID using the function start. */
- trad_frame_set_id (this_cache, frame_id_build (base, func));
-}
-
-static const struct tramp_frame m68kobsd_sigtramp = {
- SIGTRAMP_FRAME,
- 2,
- {
- { 0x206f, -1 }, { 0x000c, -1}, /* moveal %sp@(12),%a0 */
- { 0x4e90, -1 }, /* jsr %a0@ */
- { 0x588f, -1 }, /* addql #4,%sp */
- { 0x4e41, -1 }, /* trap #1 */
- { 0x2f40, -1 }, { 0x0004, -1 }, /* moveal %d0,%sp@(4) */
- { 0x7001, -1 }, /* moveq #SYS_exit,%d0 */
- { 0x4e40, -1 }, /* trap #0 */
- { TRAMP_SENTINEL_INSN, -1 }
- },
- m68kobsd_sigtramp_cache_init
-};
-\f
-
static void
m68kbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -195,30 +141,6 @@ m68kbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)

set_gdbarch_iterate_over_regset_sections
(gdbarch, m68kbsd_iterate_over_regset_sections);
-}
-
-/* OpenBSD and NetBSD a.out. */
-
-static void
-m68kbsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- m68kbsd_init_abi (info, gdbarch);
-
- tdep->struct_return = reg_struct_return;
-
- tramp_frame_prepend_unwinder (gdbarch, &m68kobsd_sigtramp);
-}
-
-/* NetBSD ELF. */
-
-static void
-m68kbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- m68kbsd_init_abi (info, gdbarch);

/* NetBSD ELF uses the SVR4 ABI. */
m68k_svr4_init_abi (info, gdbarch);
@@ -230,41 +152,12 @@ m68kbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
\f

-static enum gdb_osabi
-m68kbsd_aout_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "a.out-m68k-netbsd") == 0
- || strcmp (bfd_get_target (abfd), "a.out-m68k4k-netbsd") == 0)
- return GDB_OSABI_NETBSD_AOUT;
-
- return GDB_OSABI_UNKNOWN;
-}
-
-static enum gdb_osabi
-m68kbsd_core_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
- return GDB_OSABI_NETBSD_AOUT;
-
- return GDB_OSABI_UNKNOWN;
-}
-\f
-
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_m68kbsd_tdep (void);

void
_initialize_m68kbsd_tdep (void)
{
- gdbarch_register_osabi_sniffer (bfd_arch_m68k, bfd_target_aout_flavour,
- m68kbsd_aout_osabi_sniffer);
-
- /* BFD doesn't set a flavour for NetBSD style a.out core files. */
- gdbarch_register_osabi_sniffer (bfd_arch_m68k, bfd_target_unknown_flavour,
- m68kbsd_core_osabi_sniffer);
-
- gdbarch_register_osabi (bfd_arch_m68k, 0, GDB_OSABI_NETBSD_AOUT,
- m68kbsd_aout_init_abi);
gdbarch_register_osabi (bfd_arch_m68k, 0, GDB_OSABI_NETBSD_ELF,
- m68kbsd_elf_init_abi);
+ m68kbsd_init_abi);
}
diff --git a/gdb/osabi.c b/gdb/osabi.c
index e8a77ab..1f44ea0 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -64,16 +64,12 @@ static const struct osabi_names gdb_osabi_names[] =
{ "GNU/Hurd", NULL },
{ "Solaris", NULL },
{ "GNU/Linux", "linux(-gnu)?" },
- { "FreeBSD a.out", NULL },
- { "FreeBSD ELF", NULL },
- { "NetBSD a.out", NULL },
- { "NetBSD ELF", NULL },
- { "OpenBSD ELF", NULL },
+ { "FreeBSD", NULL },
+ { "NetBSD", NULL },
+ { "OpenBSD", NULL },
{ "Windows CE", NULL },
{ "DJGPP", NULL },
{ "Irix", NULL },
- { "HP/UX ELF", NULL },
- { "HP/UX SOM", NULL },
{ "QNX Neutrino", NULL },
{ "Cygwin", NULL },
{ "AIX", NULL },
@@ -548,6 +544,7 @@ generic_elf_osabi_sniffer (bfd *abfd)
{
case ELFOSABI_NONE:
case ELFOSABI_GNU:
+ case ELFOSABI_HPUX:
/* When the EI_OSABI field in the ELF header is ELFOSABI_NONE
(0), then the ELF structures in the file are conforming to
the base specification for that machine (there are no
@@ -556,6 +553,10 @@ generic_elf_osabi_sniffer (bfd *abfd)

The same applies for ELFOSABI_GNU: this can mean GNU/Hurd,
GNU/Linux, and possibly more. */
+
+ /* And likewise ELFOSABI_HPUX. For some reason the default
+ value for the EI_OSABI field is ELFOSABI_HPUX for all PA-RISC
+ targets (with the exception of GNU/Linux). */
bfd_map_over_sections (abfd,
generic_elf_osabi_sniff_abi_tag_sections,
&osabi);
@@ -573,17 +574,6 @@ generic_elf_osabi_sniffer (bfd *abfd)
osabi = GDB_OSABI_SOLARIS;
break;

- case ELFOSABI_HPUX:
- /* For some reason the default value for the EI_OSABI field is
- ELFOSABI_HPUX for all PA-RISC targets (with the exception of
- GNU/Linux). We use HP-UX ELF as the default, but let any
- OS-specific notes override this. */
- osabi = GDB_OSABI_HPUX_ELF;
- bfd_map_over_sections (abfd,
- generic_elf_osabi_sniff_abi_tag_sections,
- &osabi);
- break;
-
case ELFOSABI_OPENVMS:
osabi = GDB_OSABI_OPENVMS;
break;
diff --git a/gdb/ppcobsd-tdep.c b/gdb/ppcobsd-tdep.c
index 2cc62a0..0966ccb 100644
--- a/gdb/ppcobsd-tdep.c
+++ b/gdb/ppcobsd-tdep.c
@@ -262,30 +262,12 @@ ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
\f

-/* OpenBSD uses uses the traditional NetBSD core file format, even for
- ports that use ELF. */
-#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF
-
-static enum gdb_osabi
-ppcobsd_core_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
- return GDB_OSABI_NETBSD_CORE;
-
- return GDB_OSABI_UNKNOWN;
-}
-\f
-
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_ppcobsd_tdep (void);

void
_initialize_ppcobsd_tdep (void)
{
- /* BFD doesn't set a flavour for NetBSD style a.out core files. */
- gdbarch_register_osabi_sniffer (bfd_arch_powerpc, bfd_target_unknown_flavour,
- ppcobsd_core_osabi_sniffer);
-
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_OPENBSD_ELF,
ppcobsd_init_abi);
gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_OPENBSD_ELF,
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index c2b6638..bbeb709 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -6026,7 +6026,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
switch (info.osabi)
{
case GDB_OSABI_LINUX:
- case GDB_OSABI_NETBSD_AOUT:
case GDB_OSABI_NETBSD_ELF:
case GDB_OSABI_UNKNOWN:
set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c
index b5c70ef..2661cc2 100644
--- a/gdb/shnbsd-tdep.c
+++ b/gdb/shnbsd-tdep.c
@@ -71,29 +71,12 @@ shnbsd_init_abi (struct gdbarch_info info,
}
\f

-/* OpenBSD uses uses the traditional NetBSD core file format, even for
- ports that use ELF. */
-#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF
-
-static enum gdb_osabi
-shnbsd_core_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
- return GDB_OSABI_NETBSD_CORE;
-
- return GDB_OSABI_UNKNOWN;
-}
-
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_shnbsd_tdep;

void
_initialize_shnbsd_tdep (void)
{
- /* BFD doesn't set a flavour for NetBSD style a.out core files. */
- gdbarch_register_osabi_sniffer (bfd_arch_sh, bfd_target_unknown_flavour,
- shnbsd_core_osabi_sniffer);
-
gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD_ELF,
shnbsd_init_abi);
gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD_ELF,
diff --git a/gdb/solib.c b/gdb/solib.c
index 2235505..d5bc474 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1226,29 +1226,7 @@ clear_solib (void)
{
const struct target_so_ops *ops = solib_ops (target_gdbarch ());

- /* This function is expected to handle ELF shared libraries. It is
- also used on Solaris, which can run either ELF or a.out binaries
- (for compatibility with SunOS 4), both of which can use shared
- libraries. So we don't know whether we have an ELF executable or
- an a.out executable until the user chooses an executable file.
-
- ELF shared libraries don't get mapped into the address space
- until after the program starts, so we'd better not try to insert
- breakpoints in them immediately. We have to wait until the
- dynamic linker has loaded them; we'll hit a bp_shlib_event
- breakpoint (look for calls to create_solib_event_breakpoint) when
- it's ready.
-
- SunOS shared libraries seem to be different --- they're present
- as soon as the process begins execution, so there's no need to
- put off inserting breakpoints. There's also nowhere to put a
- bp_shlib_event breakpoint, so if we put it off, we'll never get
- around to it.
-
- So: disable breakpoints only if we're using ELF shared libs. */
- if (exec_bfd != NULL
- && bfd_get_flavour (exec_bfd) != bfd_target_aout_flavour)
- disable_breakpoints_in_shlibs ();
+ disable_breakpoints_in_shlibs ();

while (so_list_head)
{
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 9e951eb..370ef23 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -248,8 +248,8 @@ extern const struct sparc_gregmap sparc32nbsd_gregmap;
extern CORE_ADDR sparcnbsd_step_trap (struct frame_info *frame,
unsigned long insn);

-extern void sparc32nbsd_elf_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch);
+extern void sparc32nbsd_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch);

extern struct trad_frame_saved_reg *
sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame);
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c
index 7fa384d..e2c1fd6 100644
--- a/gdb/sparcnbsd-tdep.c
+++ b/gdb/sparcnbsd-tdep.c
@@ -290,7 +290,7 @@ static const struct regset sparc32nbsd_fpregset =
NULL, sparc32nbsd_supply_fpregset, NULL
};

-static void
+void
sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -309,54 +309,11 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->step_trap = sparcnbsd_step_trap;

frame_unwind_append_unwinder (gdbarch, &sparc32nbsd_sigcontext_frame_unwind);
-}
-
-static void
-sparc32nbsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- sparc32nbsd_init_abi (info, gdbarch);
-}
-
-void
-sparc32nbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- sparc32nbsd_init_abi (info, gdbarch);

set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
}

-static enum gdb_osabi
-sparcnbsd_aout_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "a.out-sparc-netbsd") == 0)
- return GDB_OSABI_NETBSD_AOUT;
-
- return GDB_OSABI_UNKNOWN;
-}
-
-/* OpenBSD uses the traditional NetBSD core file format, even for
- ports that use ELF. Therefore, if the default OS ABI is OpenBSD
- ELF, we return that instead of NetBSD a.out. This is mainly for
- the benfit of OpenBSD/sparc64, which inherits the sniffer below
- since we include this file for an OpenBSD/sparc64 target. For
- OpenBSD/sparc, the NetBSD a.out OS ABI is probably similar enough
- to both the OpenBSD a.out and the OpenBSD ELF OS ABI. */
-#if defined (GDB_OSABI_DEFAULT) && (GDB_OSABI_DEFAULT == GDB_OSABI_OPENBSD_ELF)
-#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF
-#else
-#define GDB_OSABI_NETBSD_CORE GDB_OSABI_NETBSD_AOUT
-#endif
-
-static enum gdb_osabi
-sparcnbsd_core_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
- return GDB_OSABI_NETBSD_CORE;
-
- return GDB_OSABI_UNKNOWN;
-}
-
\f
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_sparcnbsd_tdep (void);
@@ -364,15 +321,6 @@ void _initialize_sparcnbsd_tdep (void);
void
_initialize_sparcnbsd_tdep (void)
{
- gdbarch_register_osabi_sniffer (bfd_arch_sparc, bfd_target_aout_flavour,
- sparcnbsd_aout_osabi_sniffer);
-
- /* BFD doesn't set a flavour for NetBSD style a.out core files. */
- gdbarch_register_osabi_sniffer (bfd_arch_sparc, bfd_target_unknown_flavour,
- sparcnbsd_core_osabi_sniffer);
-
- gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD_AOUT,
- sparc32nbsd_aout_init_abi);
gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD_ELF,
- sparc32nbsd_elf_init_abi);
+ sparc32nbsd_init_abi);
}
diff --git a/gdb/sparcobsd-tdep.c b/gdb/sparcobsd-tdep.c
index 6a40eb9..5bd1db7 100644
--- a/gdb/sparcobsd-tdep.c
+++ b/gdb/sparcobsd-tdep.c
@@ -237,7 +237,7 @@ sparc32obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);

/* OpenBSD/sparc is very similar to NetBSD/sparc ELF. */
- sparc32nbsd_elf_init_abi (info, gdbarch);
+ sparc32nbsd_init_abi (info, gdbarch);

set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);

diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 74260b7..b3fa73c 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -18,10 +18,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */

/* Support routines for reading and decoding debugging information in
- the "stabs" format. This format is used with many systems that use
- the a.out object file format, as well as some systems that use
- COFF or ELF where the stabs data is placed in a special section.
- Avoid placing any object file format specific code in this file. */
+ the "stabs" format. This format is used by some systems that use
+ COFF or ELF where the stabs data is placed in a special section (as
+ well as with many old systems that used the a.out object file
+ format). Avoid placing any object file format specific code in
+ this file. */

#include "defs.h"
#include "bfd.h"
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 69b7e8e..64db439 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -139,7 +139,7 @@ print_objfile_statistics (void)
blockvectors);

if (OBJSTAT (objfile, sz_strtab) > 0)
- printf_filtered (_(" Space used by a.out string tables: %d\n"),
+ printf_filtered (_(" Space used by string tables: %d\n"),
OBJSTAT (objfile, sz_strtab));
printf_filtered (_(" Total memory used for objfile obstack: %s\n"),
pulongest (obstack_memory_used (&objfile
diff --git a/gdb/vaxobsd-tdep.c b/gdb/vaxobsd-tdep.c
index ee48ac6..8a81861 100644
--- a/gdb/vaxobsd-tdep.c
+++ b/gdb/vaxobsd-tdep.c
@@ -27,152 +27,3 @@

#include "vax-tdep.h"

-/* Signal trampolines. */
-
-/* Since OpenBSD 3.2, the sigtramp routine is mapped at a random page
- in virtual memory. The randomness makes it somewhat tricky to
- detect it, but fortunately we can rely on the fact that the start
- of the sigtramp routine is page-aligned. We recognize the
- trampoline by looking for the code that invokes the sigreturn
- system call. The offset where we can find that code varies from
- release to release.
-
- By the way, the mapping mentioned above is read-only, so you cannot
- place a breakpoint in the signal trampoline. */
-
-/* Default page size. */
-static const int vaxobsd_page_size = 4096;
-
-/* Offset for sigreturn(2). */
-static const int vaxobsd_sigreturn_offset = 0x11;
-
-/* Instruction sequence for sigreturn(2). VAX doesn't have
- fixed-length instructions so we include the ensuing exit(2) to
- reduce the chance of spurious matches. */
-static const gdb_byte vaxobsd_sigreturn[] = {
- 0xbc, 0x8f, 0x67, 0x00, /* chmk $SYS_sigreturn */
- 0xbc, 0x01 /* chmk $SYS_exit */
-};
-
-static int
-vaxobsd_sigtramp_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
-{
- CORE_ADDR pc = get_frame_pc (this_frame);
- CORE_ADDR start_pc = (pc & ~(vaxobsd_page_size - 1));
- CORE_ADDR sigreturn_addr = start_pc + vaxobsd_sigreturn_offset;
- gdb_byte *buf;
- const char *name;
-
- find_pc_partial_function (pc, &name, NULL, NULL);
- if (name)
- return 0;
-
- buf = (gdb_byte *) alloca (sizeof vaxobsd_sigreturn);
- if (!safe_frame_unwind_memory (this_frame, sigreturn_addr,
- buf, sizeof vaxobsd_sigreturn))
- return 0;
-
- if (memcmp(buf, vaxobsd_sigreturn, sizeof vaxobsd_sigreturn) == 0)
- return 1;
-
- return 0;
-}
-
-static struct trad_frame_cache *
-vaxobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
-{
- struct trad_frame_cache *cache;
- CORE_ADDR addr, base, func;
-
- if (*this_cache)
- return (struct trad_frame_cache *) *this_cache;
-
- cache = trad_frame_cache_zalloc (this_frame);
- *this_cache = cache;
-
- func = get_frame_pc (this_frame);
- func &= ~(vaxobsd_page_size - 1);
-
- base = get_frame_register_unsigned (this_frame, VAX_SP_REGNUM);
- addr = get_frame_memory_unsigned (this_frame, base - 4, 4);
-
- trad_frame_set_reg_addr (cache, VAX_SP_REGNUM, addr + 8);
- trad_frame_set_reg_addr (cache, VAX_FP_REGNUM, addr + 12);
- trad_frame_set_reg_addr (cache, VAX_AP_REGNUM, addr + 16);
- trad_frame_set_reg_addr (cache, VAX_PC_REGNUM, addr + 20);
- trad_frame_set_reg_addr (cache, VAX_PS_REGNUM, addr + 24);
-
- /* Construct the frame ID using the function start. */
- trad_frame_set_id (cache, frame_id_build (base, func));
-
- return cache;
-}
-
-static void
-vaxobsd_sigtramp_frame_this_id (struct frame_info *this_frame,
- void **this_cache, struct frame_id *this_id)
-{
- struct trad_frame_cache *cache =
- vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
-
- trad_frame_get_id (cache, this_id);
-}
-
-static struct value *
-vaxobsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
-{
- struct trad_frame_cache *cache =
- vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
-
- return trad_frame_get_register (cache, this_frame, regnum);
-}
-
-static const struct frame_unwind vaxobsd_sigtramp_frame_unwind = {
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- vaxobsd_sigtramp_frame_this_id,
- vaxobsd_sigtramp_frame_prev_register,
- NULL,
- vaxobsd_sigtramp_sniffer
-};
-\f
-
-/* OpenBSD a.out. */
-
-static void
-vaxobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
- frame_unwind_append_unwinder (gdbarch, &vaxobsd_sigtramp_frame_unwind);
-}
-
-/* FIXME: kettenis/20050821: Since OpenBSD/vax binaries are
- indistingushable from NetBSD/vax a.out binaries, building a GDB
- that should support both these targets will probably not work as
- expected. */
-#define GDB_OSABI_OPENBSD_AOUT GDB_OSABI_NETBSD_AOUT
-
-static enum gdb_osabi
-vaxobsd_aout_osabi_sniffer (bfd *abfd)
-{
- if (strcmp (bfd_get_target (abfd), "a.out-vax-netbsd") == 0)
- return GDB_OSABI_OPENBSD_AOUT;
-
- return GDB_OSABI_UNKNOWN;
-}
-\f
-
-/* Provide a prototype to silence -Wmissing-prototypes. */
-void _initialize_vaxobsd_tdep (void);
-
-void
-_initialize_vaxobsd_tdep (void)
-{
- gdbarch_register_osabi_sniffer (bfd_arch_vax, bfd_target_aout_flavour,
- vaxobsd_aout_osabi_sniffer);
-
- gdbarch_register_osabi (bfd_arch_vax, 0, GDB_OSABI_OPENBSD_AOUT,
- vaxobsd_init_abi);
-}
--
2.5.0