public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Avoid spaces in osabi names
@ 2016-03-07 19:02 Pedro Alves
  2016-03-07 19:12 ` Simon Marchi
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Pedro Alves @ 2016-03-07 19:02 UTC (permalink / raw)
  To: gdb-patches

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 },
+  { "QNX-Neutrino", NULL },
   { "Cygwin", NULL },
   { "AIX", NULL },
   { "DICOS", NULL },
-- 
2.5.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Avoid spaces in osabi names
  2016-03-07 19:02 [PATCH] Avoid spaces in osabi names Pedro Alves
@ 2016-03-07 19:12 ` Simon Marchi
  2016-03-09  1:34   ` [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names) Pedro Alves
  2016-03-08 20:59 ` [PATCH] Avoid spaces in osabi names Joel Brobecker
  2016-12-09 16:57 ` [PATCH] Don't allow whitespace in enum values of enum commands (Re: [PATCH] Avoid spaces in osabi names) Pedro Alves
  2 siblings, 1 reply; 10+ messages in thread
From: Simon Marchi @ 2016-03-07 19:12 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

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?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Avoid spaces in osabi names
  2016-03-07 19:02 [PATCH] Avoid spaces in osabi names Pedro Alves
  2016-03-07 19:12 ` Simon Marchi
@ 2016-03-08 20:59 ` Joel Brobecker
  2016-03-09 15:58   ` Pedro Alves
  2016-12-09 16:57 ` [PATCH] Don't allow whitespace in enum values of enum commands (Re: [PATCH] Avoid spaces in osabi names) Pedro Alves
  2 siblings, 1 reply; 10+ messages in thread
From: Joel Brobecker @ 2016-03-08 20:59 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Hi Pedro,

> gdb/ChangeLog:
> 2016-03-07  Pedro Alves  <palves@redhat.com>
> 
> 	* osabi.c (gdb_osabi_names): Avoid spaces in osabi names.

FWIW, I think this is the best compromise. The new names you chose
also look good to me.

-- 
Joel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names)
  2016-03-07 19:12 ` Simon Marchi
@ 2016-03-09  1:34   ` Pedro Alves
  2016-04-19 19:26     ` John Baldwin
  0 siblings, 1 reply; 10+ messages in thread
From: Pedro Alves @ 2016-03-09  1:34 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches, Mark Kettenis

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Avoid spaces in osabi names
  2016-03-08 20:59 ` [PATCH] Avoid spaces in osabi names Joel Brobecker
@ 2016-03-09 15:58   ` Pedro Alves
  0 siblings, 0 replies; 10+ messages in thread
From: Pedro Alves @ 2016-03-09 15:58 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 03/08/2016 08:59 PM, Joel Brobecker wrote:
> Hi Pedro,
> 
>> gdb/ChangeLog:
>> 2016-03-07  Pedro Alves  <palves@redhat.com>
>>
>> 	* osabi.c (gdb_osabi_names): Avoid spaces in osabi names.
> 
> FWIW, I think this is the best compromise. The new names you chose
> also look good to me.

Alright, pushed.  Thanks.

I should point out: the osabi can also be sent in XML target 
descriptions, but gdbserver is currently only including
an <osabi> element on GNU/Linux target descriptions.  Hopefully
no stub outside our tree is sending any of the affected names.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names)
  2016-03-09  1:34   ` [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names) Pedro Alves
@ 2016-04-19 19:26     ` John Baldwin
  2016-04-20 18:50       ` Joel Brobecker
  0 siblings, 1 reply; 10+ messages in thread
From: John Baldwin @ 2016-04-19 19:26 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pedro Alves, Simon Marchi, Mark Kettenis

On Wednesday, March 09, 2016 01:34:30 AM Pedro Alves wrote:
> 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?

With my FreeBSD hat on, I think it would be fine to drop a.out support.
FreeBSD still permits running a.out binaries, but if someone really wants
to debug that they can probably grab an older snapshot of gdb if they
really care.  (FreeBSD has used ELF for binaries and cores since 3.0
which was released in October 1998.  The last release to ship a.out
binaries was 2.2.8 released in November of 1998.)

-- 
John Baldwin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names)
  2016-04-19 19:26     ` John Baldwin
@ 2016-04-20 18:50       ` Joel Brobecker
  2016-04-22 13:14         ` Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Joel Brobecker @ 2016-04-20 18:50 UTC (permalink / raw)
  To: John Baldwin; +Cc: gdb-patches, Pedro Alves, Simon Marchi, Mark Kettenis

> With my FreeBSD hat on, I think it would be fine to drop a.out support.
> FreeBSD still permits running a.out binaries, but if someone really wants
> to debug that they can probably grab an older snapshot of gdb if they
> really care.  (FreeBSD has used ELF for binaries and cores since 3.0
> which was released in October 1998.  The last release to ship a.out
> binaries was 2.2.8 released in November of 1998.)

Thanks for the info! Given what you said, I also think it is fair to
drop a.out. Should have done that a while ago, actually! :-)

-- 
Joel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names)
  2016-04-20 18:50       ` Joel Brobecker
@ 2016-04-22 13:14         ` Pedro Alves
  2016-12-09 16:25           ` [pushed] " Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Pedro Alves @ 2016-04-22 13:14 UTC (permalink / raw)
  To: Joel Brobecker, John Baldwin; +Cc: gdb-patches, Simon Marchi, Mark Kettenis

On 04/20/2016 07:50 PM, Joel Brobecker wrote:
>> With my FreeBSD hat on, I think it would be fine to drop a.out support.
>> FreeBSD still permits running a.out binaries, but if someone really wants
>> to debug that they can probably grab an older snapshot of gdb if they
>> really care.  (FreeBSD has used ELF for binaries and cores since 3.0
>> which was released in October 1998.  The last release to ship a.out
>> binaries was 2.2.8 released in November of 1998.)
> 
> Thanks for the info! Given what you said, I also think it is fair to
> drop a.out. Should have done that a while ago, actually! :-)

Alright, I'll push it in soon then.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pushed] Re: [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names)
  2016-04-22 13:14         ` Pedro Alves
@ 2016-12-09 16:25           ` Pedro Alves
  0 siblings, 0 replies; 10+ messages in thread
From: Pedro Alves @ 2016-12-09 16:25 UTC (permalink / raw)
  To: Joel Brobecker, John Baldwin; +Cc: gdb-patches, Simon Marchi, Mark Kettenis

On 04/22/2016 02:14 PM, Pedro Alves wrote:
> On 04/20/2016 07:50 PM, Joel Brobecker wrote:
>>> With my FreeBSD hat on, I think it would be fine to drop a.out support.
>>> FreeBSD still permits running a.out binaries, but if someone really wants
>>> to debug that they can probably grab an older snapshot of gdb if they
>>> really care.  (FreeBSD has used ELF for binaries and cores since 3.0
>>> which was released in October 1998.  The last release to ship a.out
>>> binaries was 2.2.8 released in November of 1998.)
>>
>> Thanks for the info! Given what you said, I also think it is fair to
>> drop a.out. Should have done that a while ago, actually! :-)
> 
> Alright, I'll push it in soon then.

Now that the all-architectures.exp test is in (which exercises all
osabis), I've finally pushed this in, as below.

From 1736a7bd96e8927c3f889a35f9153df4fd19d833 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 9 Dec 2016 16:08:49 +0000
Subject: [PATCH] gdb: Remove support for obsolete OSABIs and a.out

gdb/ChangeLog:
2016-12-09  Pedro Alves  <palves@redhat.com>

	* Makefile.in (ALL_TARGET_OBS): Remove vax-obsd-tdep.o.
	* alpha-fbsd-tdep.c (_initialize_alphafbsd_tdep): Adjust.
	* alpha-nbsd-tdep.c: Move comment to _initialize_alphanbsd_tdep.
	(alphanbsd_core_osabi_sniffer): Delete.
	(_initialize_alphanbsd_tdep): No longer handle a.out.
	* alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Adjust.
	* amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Adjust.
	* amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Adjust.
	* amd64-obsd-tdep.c (amd64obsd_supply_regset)
	(amd64obsd_combined_regset)
	(amd64obsd_iterate_over_regset_sections, amd64obsd_core_init_abi):
	Delete.
	(_initialize_amd64obsd_tdep): Don't handle a.out.
	* arm-nbsd-nat.c (struct md_core, fetch_core_registers)
	(arm_netbsd_core_fns): Delete.
	(_initialize_arm_netbsd_nat): Don't register arm_netbsd_core_fns.
	* arm-nbsd-tdep.c (arm_netbsd_aout_init_abi)
	(arm_netbsd_aout_osabi_sniffer): Delete.
	(_initialize_arm_netbsd_tdep): Don't handle a.out.
	* arm-obsd-tdep.c (armobsd_core_osabi_sniffer): Delete.
	(_initialize_armobsd_tdep): Don't handle a.out.
	* arm-tdep.c (arm_gdbarch_init): Remove bfd_target_aout_flavour
	case.
	* breakpoint.c (disable_breakpoints_in_unloaded_shlib): Remove
	SunOS a.out handling.
	* configure.tgt (vax-*-netbsd* | vax-*-knetbsd*-gnu): Remove
	vax-obsd-tdep.o from gdb_target_objs.
	(vax-*-openbsd*): Likewise.
	(*-*-freebsd*): Adjust default gdb_osabi.
	(*-*-openbsd*): Likewise.
	* dbxread.c (block_address_function_relative): Delete.
	(dbx_symfile_read): Remove reference to
	block_address_function_relative.
	(dbx_symfile_read): Don't call read_dbx_dynamic_symtab.
	(read_dbx_dynamic_symtab): Delete.
	(process_one_symbol): Remove references to
	block_address_function_relative.
	* defs.h (GDB_OSABI_FREEBSD_AOUT, GDB_OSABI_NETBSD_AOUT): Remove.
	(GDB_OSABI_FREEBSD_ELF): Rename to ...
	(GDB_OSABI_FREEBSD): ... this.
	(GDB_OSABI_NETBSD_ELF): Rename to ...
	(GDB_OSABI_NETBSD): ... this.
	(GDB_OSABI_OPENBSD_ELF): Rename to ...
	(GDB_OSABI_OPENBSD): ... this.
	(GDB_OSABI_HPUX_ELF, GDB_OSABI_HPUX_SOM): Remove.
	* fbsd-tdep.c: Adjust comment.
	* hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Adjust.
	* hppa-obsd-tdep.c (GDB_OSABI_NETBSD_CORE): Delete.
	(hppaobsd_core_osabi_sniffer): Delete.
	(_initialize_hppabsd_tdep): Don't handle a.out.
	* hppa-tdep.c (hppa_stub_frame_unwind_cache): Don't handle
	GDB_OSABI_HPUX_SOM.
	(hppa_gdbarch_init): Likewise.
	* i386-bsd-tdep.c (i386bsd_aout_osabi_sniffer)
	(i386bsd_core_osabi_sniffer, _initialize_i386bsd_tdep): Delete.
	* i386-fbsd-tdep.c (i386fbsdaout_init_abi): Delete.  Merge bits
	with ...
	(i386fbsd_init_abi): ... this.
	(_initialize_i386fbsd_tdep): Don't handle a.out.
	* i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Adjust.
	* i386-obsd-tdep.c (i386obsd_aout_supply_regset)
	(i386obsd_aout_gregset)
	(i386obsd_aout_iterate_over_regset_sections): Delete.
	(i386obsd_init_abi): Merge with i386obsd_elf_init_abi.
	(i386obsd_aout_init_abi): Delete.
	(_initialize_i386obsd_tdep): Don't handle a.out.
	* m68k-bsd-tdep.c (m68kobsd_sigtramp_cache_init)
	(m68kobsd_sigtramp): Delete.
	(m68kbsd_init_abi): Merge with ...
	(m68kbsd_elf_init_abi): ... this, and delete it.
	(m68kbsd_aout_init_abi): Delete.
	(m68kbsd_aout_osabi_sniffer, m68kbsd_core_osabi_sniffer): Delete.
	(_initialize_m68kbsd_tdep): Don't handle a.out.
	* mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Adjust.
	* mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Adjust.
	* osabi.c (gdb_osabi_names): Remove "a.out" entries.  Drop "ELF"
	suffixes.  Remove "HP-UX" entries.
	(generic_elf_osabi_sniff_abi_tag_sections): Adjust.
	(generic_elf_osabi_sniffer): No longer handle GDB_OSABI_HPUX_ELF.
	Adjust.
	(_initialize_ppcfbsd_tdep): Adjust.
	* ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Adjust.
	* ppc-obsd-tdep.c (GDB_OSABI_NETBSD_CORE)
	(ppcobsd_core_osabi_sniffer): Delete.
	(_initialize_ppcobsd_tdep): Don't handle a.out.
	* rs6000-tdep.c (rs6000_gdbarch_init): Adjust.
	* sh-nbsd-tdep.c (GDB_OSABI_NETBSD_CORE)
	(shnbsd_core_osabi_sniffer): Delete.
	(_initialize_shnbsd_tdep): Don't handle a.out.
	* solib.c (clear_solib): Don't handle SunOS/a.out.
	* sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Make extern.
	(sparc32nbsd_aout_init_abi): Delete.
	(sparc32nbsd_elf_init_abi): Merged into sparc32nbsd_init_abi.
	(sparcnbsd_aout_osabi_sniffer): Delete.
	(GDB_OSABI_NETBSD_CORE, sparcnbsd_core_osabi_sniffer): Delete.
	(_initialize_sparcnbsd_tdep): No longer handle a.out.
	* sparc-obsd-tdep.c (sparc32obsd_init_abi)
	(_initialize_sparc32obsd_tdep): Adjust.
	* sparc-tdep.h (sparc32nbsd_elf_init_abi): Rename to ...
	(sparc32nbsd_init_abi): ... this.
	* sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Adjust.
	* sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Adjust.
	* sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Adjust.
	* stabsread.c: Update comment.
	* symmisc.c (print_objfile_statistics): Don't mention "a.out" in
	output.
	* vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Adjust.
	* vax-obsd-tdep.c: Delete file.
---
 gdb/ChangeLog           | 111 ++++++++++++++++++++++++++
 gdb/Makefile.in         |   1 -
 gdb/alpha-fbsd-tdep.c   |   2 +-
 gdb/alpha-nbsd-tdep.c   |  22 +-----
 gdb/alpha-obsd-tdep.c   |   2 +-
 gdb/amd64-fbsd-tdep.c   |   2 +-
 gdb/amd64-nbsd-tdep.c   |   2 +-
 gdb/amd64-obsd-tdep.c   |  55 +------------
 gdb/arm-nbsd-nat.c      |  29 -------
 gdb/arm-nbsd-tdep.c     |  27 +------
 gdb/arm-obsd-tdep.c     |  15 +---
 gdb/arm-tdep.c          |   5 --
 gdb/breakpoint.c        |   8 --
 gdb/configure.tgt       |   8 +-
 gdb/dbxread.c           | 201 ++----------------------------------------------
 gdb/defs.h              |  10 +--
 gdb/fbsd-tdep.c         |   2 +-
 gdb/hppa-nbsd-tdep.c    |   2 +-
 gdb/hppa-obsd-tdep.c    |  20 +----
 gdb/hppa-tdep.c         |  23 ------
 gdb/i386-bsd-tdep.c     |  35 ---------
 gdb/i386-fbsd-tdep.c    |  16 +---
 gdb/i386-nbsd-tdep.c    |   2 +-
 gdb/i386-obsd-tdep.c    |  71 +----------------
 gdb/m68k-bsd-tdep.c     | 111 +-------------------------
 gdb/mips-nbsd-tdep.c    |   2 +-
 gdb/mips64-obsd-tdep.c  |   2 +-
 gdb/osabi.c             |  44 ++++-------
 gdb/ppc-fbsd-tdep.c     |   7 +-
 gdb/ppc-nbsd-tdep.c     |   2 +-
 gdb/ppc-obsd-tdep.c     |  22 +-----
 gdb/rs6000-tdep.c       |   3 +-
 gdb/sh-nbsd-tdep.c      |  21 +----
 gdb/solib.c             |  24 +-----
 gdb/sparc-nbsd-tdep.c   |  58 +-------------
 gdb/sparc-obsd-tdep.c   |   4 +-
 gdb/sparc-tdep.h        |   4 +-
 gdb/sparc64-fbsd-tdep.c |   2 +-
 gdb/sparc64-nbsd-tdep.c |   2 +-
 gdb/sparc64-obsd-tdep.c |   2 +-
 gdb/stabsread.c         |   9 ++-
 gdb/symmisc.c           |   2 +-
 gdb/vax-nbsd-tdep.c     |   2 +-
 gdb/vax-obsd-tdep.c     | 178 ------------------------------------------
 44 files changed, 193 insertions(+), 979 deletions(-)
 delete mode 100644 gdb/vax-obsd-tdep.c

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cba6514..f115283 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,114 @@
+2016-12-09  Pedro Alves  <palves@redhat.com>
+
+	* Makefile.in (ALL_TARGET_OBS): Remove vax-obsd-tdep.o.
+	* alpha-fbsd-tdep.c (_initialize_alphafbsd_tdep): Adjust.
+	* alpha-nbsd-tdep.c: Move comment to _initialize_alphanbsd_tdep.
+	(alphanbsd_core_osabi_sniffer): Delete.
+	(_initialize_alphanbsd_tdep): No longer handle a.out.
+	* alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Adjust.
+	* amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Adjust.
+	* amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Adjust.
+	* amd64-obsd-tdep.c (amd64obsd_supply_regset)
+	(amd64obsd_combined_regset)
+	(amd64obsd_iterate_over_regset_sections, amd64obsd_core_init_abi):
+	Delete.
+	(_initialize_amd64obsd_tdep): Don't handle a.out.
+	* arm-nbsd-nat.c (struct md_core, fetch_core_registers)
+	(arm_netbsd_core_fns): Delete.
+	(_initialize_arm_netbsd_nat): Don't register arm_netbsd_core_fns.
+	* arm-nbsd-tdep.c (arm_netbsd_aout_init_abi)
+	(arm_netbsd_aout_osabi_sniffer): Delete.
+	(_initialize_arm_netbsd_tdep): Don't handle a.out.
+	* arm-obsd-tdep.c (armobsd_core_osabi_sniffer): Delete.
+	(_initialize_armobsd_tdep): Don't handle a.out.
+	* arm-tdep.c (arm_gdbarch_init): Remove bfd_target_aout_flavour
+	case.
+	* breakpoint.c (disable_breakpoints_in_unloaded_shlib): Remove
+	SunOS a.out handling.
+	* configure.tgt (vax-*-netbsd* | vax-*-knetbsd*-gnu): Remove
+	vax-obsd-tdep.o from gdb_target_objs.
+	(vax-*-openbsd*): Likewise.
+	(*-*-freebsd*): Adjust default gdb_osabi.
+	(*-*-openbsd*): Likewise.
+	* dbxread.c (block_address_function_relative): Delete.
+	(dbx_symfile_read): Remove reference to
+	block_address_function_relative.
+	(dbx_symfile_read): Don't call read_dbx_dynamic_symtab.
+	(read_dbx_dynamic_symtab): Delete.
+	(process_one_symbol): Remove references to
+	block_address_function_relative.
+	* defs.h (GDB_OSABI_FREEBSD_AOUT, GDB_OSABI_NETBSD_AOUT): Remove.
+	(GDB_OSABI_FREEBSD_ELF): Rename to ...
+	(GDB_OSABI_FREEBSD): ... this.
+	(GDB_OSABI_NETBSD_ELF): Rename to ...
+	(GDB_OSABI_NETBSD): ... this.
+	(GDB_OSABI_OPENBSD_ELF): Rename to ...
+	(GDB_OSABI_OPENBSD): ... this.
+	(GDB_OSABI_HPUX_ELF, GDB_OSABI_HPUX_SOM): Remove.
+	* fbsd-tdep.c: Adjust comment.
+	* hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Adjust.
+	* hppa-obsd-tdep.c (GDB_OSABI_NETBSD_CORE): Delete.
+	(hppaobsd_core_osabi_sniffer): Delete.
+	(_initialize_hppabsd_tdep): Don't handle a.out.
+	* hppa-tdep.c (hppa_stub_frame_unwind_cache): Don't handle
+	GDB_OSABI_HPUX_SOM.
+	(hppa_gdbarch_init): Likewise.
+	* i386-bsd-tdep.c (i386bsd_aout_osabi_sniffer)
+	(i386bsd_core_osabi_sniffer, _initialize_i386bsd_tdep): Delete.
+	* i386-fbsd-tdep.c (i386fbsdaout_init_abi): Delete.  Merge bits
+	with ...
+	(i386fbsd_init_abi): ... this.
+	(_initialize_i386fbsd_tdep): Don't handle a.out.
+	* i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Adjust.
+	* i386-obsd-tdep.c (i386obsd_aout_supply_regset)
+	(i386obsd_aout_gregset)
+	(i386obsd_aout_iterate_over_regset_sections): Delete.
+	(i386obsd_init_abi): Merge with i386obsd_elf_init_abi.
+	(i386obsd_aout_init_abi): Delete.
+	(_initialize_i386obsd_tdep): Don't handle a.out.
+	* m68k-bsd-tdep.c (m68kobsd_sigtramp_cache_init)
+	(m68kobsd_sigtramp): Delete.
+	(m68kbsd_init_abi): Merge with ...
+	(m68kbsd_elf_init_abi): ... this, and delete it.
+	(m68kbsd_aout_init_abi): Delete.
+	(m68kbsd_aout_osabi_sniffer, m68kbsd_core_osabi_sniffer): Delete.
+	(_initialize_m68kbsd_tdep): Don't handle a.out.
+	* mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Adjust.
+	* mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Adjust.
+	* osabi.c (gdb_osabi_names): Remove "a.out" entries.  Drop "ELF"
+	suffixes.  Remove "HP-UX" entries.
+	(generic_elf_osabi_sniff_abi_tag_sections): Adjust.
+	(generic_elf_osabi_sniffer): No longer handle GDB_OSABI_HPUX_ELF.
+	Adjust.
+	(_initialize_ppcfbsd_tdep): Adjust.
+	* ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Adjust.
+	* ppc-obsd-tdep.c (GDB_OSABI_NETBSD_CORE)
+	(ppcobsd_core_osabi_sniffer): Delete.
+	(_initialize_ppcobsd_tdep): Don't handle a.out.
+	* rs6000-tdep.c (rs6000_gdbarch_init): Adjust.
+	* sh-nbsd-tdep.c (GDB_OSABI_NETBSD_CORE)
+	(shnbsd_core_osabi_sniffer): Delete.
+	(_initialize_shnbsd_tdep): Don't handle a.out.
+	* solib.c (clear_solib): Don't handle SunOS/a.out.
+	* sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Make extern.
+	(sparc32nbsd_aout_init_abi): Delete.
+	(sparc32nbsd_elf_init_abi): Merged into sparc32nbsd_init_abi.
+	(sparcnbsd_aout_osabi_sniffer): Delete.
+	(GDB_OSABI_NETBSD_CORE, sparcnbsd_core_osabi_sniffer): Delete.
+	(_initialize_sparcnbsd_tdep): No longer handle a.out.
+	* sparc-obsd-tdep.c (sparc32obsd_init_abi)
+	(_initialize_sparc32obsd_tdep): Adjust.
+	* sparc-tdep.h (sparc32nbsd_elf_init_abi): Rename to ...
+	(sparc32nbsd_init_abi): ... this.
+	* sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Adjust.
+	* sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Adjust.
+	* sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Adjust.
+	* stabsread.c: Update comment.
+	* symmisc.c (print_objfile_statistics): Don't mention "a.out" in
+	output.
+	* vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Adjust.
+	* vax-obsd-tdep.c: Delete file.
+
 2016-12-09  Yao Qi  <yao.qi@linaro.org>
 
 	PR tdep/20954
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 2cf1b3d..946d440 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -873,7 +873,6 @@ ALL_TARGET_OBS = \
 	tilegx-tdep.o \
 	v850-tdep.o \
 	vax-nbsd-tdep.o \
-	vax-obsd-tdep.o \
 	vax-tdep.o \
 	windows-tdep.o \
 	xcoffread.o \
diff --git a/gdb/alpha-fbsd-tdep.c b/gdb/alpha-fbsd-tdep.c
index 84fedc2..6328f1e 100644
--- a/gdb/alpha-fbsd-tdep.c
+++ b/gdb/alpha-fbsd-tdep.c
@@ -127,6 +127,6 @@ void _initialize_alphafbsd_tdep (void);
 void
 _initialize_alphafbsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_FREEBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_FREEBSD,
                           alphafbsd_init_abi);
 }
diff --git a/gdb/alpha-nbsd-tdep.c b/gdb/alpha-nbsd-tdep.c
index 00ff481..b84b691 100644
--- a/gdb/alpha-nbsd-tdep.c
+++ b/gdb/alpha-nbsd-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);
-
-  gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_NETBSD_ELF,
+  /* 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,
                           alphanbsd_init_abi);
 }
diff --git a/gdb/alpha-obsd-tdep.c b/gdb/alpha-obsd-tdep.c
index 98436f3..2ed8a58 100644
--- a/gdb/alpha-obsd-tdep.c
+++ b/gdb/alpha-obsd-tdep.c
@@ -132,6 +132,6 @@ void _initialize_alphaobsd_tdep (void);
 void
 _initialize_alphaobsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OPENBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OPENBSD,
                           alphaobsd_init_abi);
 }
diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c
index d3c4270..bd591af 100644
--- a/gdb/amd64-fbsd-tdep.c
+++ b/gdb/amd64-fbsd-tdep.c
@@ -315,5 +315,5 @@ void
 _initialize_amd64fbsd_tdep (void)
 {
   gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
-			  GDB_OSABI_FREEBSD_ELF, amd64fbsd_init_abi);
+			  GDB_OSABI_FREEBSD, amd64fbsd_init_abi);
 }
diff --git a/gdb/amd64-nbsd-tdep.c b/gdb/amd64-nbsd-tdep.c
index 9e3cb11..6d37ffd 100644
--- a/gdb/amd64-nbsd-tdep.c
+++ b/gdb/amd64-nbsd-tdep.c
@@ -129,5 +129,5 @@ _initialize_amd64nbsd_tdep (void)
   gdb_assert (ARRAY_SIZE (amd64nbsd_r_reg_offset) == AMD64_NUM_GREGS);
 
   gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
-			  GDB_OSABI_NETBSD_ELF, amd64nbsd_init_abi);
+			  GDB_OSABI_NETBSD, amd64nbsd_init_abi);
 }
diff --git a/gdb/amd64-obsd-tdep.c b/gdb/amd64-obsd-tdep.c
index 7c79e44..bbf0908 100644
--- a/gdb/amd64-obsd-tdep.c
+++ b/gdb/amd64-obsd-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.  */
@@ -506,9 +457,5 @@ _initialize_amd64obsd_tdep (void)
   gdb_assert (ARRAY_SIZE (amd64obsd_r_reg_offset) == AMD64_NUM_GREGS);
 
   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);
+			  GDB_OSABI_OPENBSD, amd64obsd_init_abi);
 }
diff --git a/gdb/arm-nbsd-nat.c b/gdb/arm-nbsd-nat.c
index c8b549e..f9fd7be 100644
--- a/gdb/arm-nbsd-nat.c
+++ b/gdb/arm-nbsd-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/arm-nbsd-tdep.c b/gdb/arm-nbsd-tdep.c
index 259853c..e4d8fbe 100644
--- a/gdb/arm-nbsd-tdep.c
+++ b/gdb/arm-nbsd-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,
+  gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD,
                           arm_netbsd_elf_init_abi);
 }
diff --git a/gdb/arm-obsd-tdep.c b/gdb/arm-obsd-tdep.c
index 5ccf1d1..9031903 100644
--- a/gdb/arm-obsd-tdep.c
+++ b/gdb/arm-obsd-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,
+  gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_OPENBSD,
 			  armobsd_init_abi);
 }
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 97dea89..937fb8b 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -8990,11 +8990,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/breakpoint.c b/gdb/breakpoint.c
index 38262ba..92aac3a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -7957,14 +7957,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 3a1ea6f..3f2603d 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -643,11 +643,11 @@ v850*-*-elf | v850*-*-rtems*)
 
 vax-*-netbsd* | vax-*-knetbsd*-gnu)
 	# Target: NetBSD/vax
-	gdb_target_obs="vax-tdep.o vax-nbsd-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 vax-obsd-tdep.o"
+	gdb_target_obs="vax-tdep.o"
 	;;
 vax-*-*)
 	# Target: VAX
@@ -720,12 +720,12 @@ esac
 
 case "${targ}" in
 *-*-freebsd* | *-*-kfreebsd*-gnu)
-		gdb_osabi=GDB_OSABI_FREEBSD_ELF ;;
+		gdb_osabi=GDB_OSABI_FREEBSD ;;
 *-*-linux* | *-*-uclinux*)
 		gdb_osabi=GDB_OSABI_LINUX ;;
 *-*-nto*)	gdb_osabi=GDB_OSABI_QNXNTO ;;
 m68*-*-openbsd* | m88*-*-openbsd* | vax-*-openbsd*) ;;
-*-*-openbsd*)	gdb_osabi=GDB_OSABI_OPENBSD_ELF ;;
+*-*-openbsd*)	gdb_osabi=GDB_OSABI_OPENBSD ;;
 *-*-solaris*)	gdb_osabi=GDB_OSABI_SOLARIS ;;
 *-*-*-gnu*)	;; # prevent non-GNU kernels to match the Hurd rule below
 *-*-gnu*)	gdb_osabi=GDB_OSABI_HURD ;;
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index cfc4ed0..ed3511f 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,9 +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 (minimal_symbol_reader &reader,
-				     struct objfile *objfile);
-
 static void read_dbx_symtab (minimal_symbol_reader &, struct objfile *);
 
 static void free_bincl_list (struct objfile *);
@@ -534,18 +527,6 @@ dbx_symfile_read (struct objfile *objfile, symfile_add_flags 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));
@@ -566,10 +547,6 @@ dbx_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
 
   read_dbx_symtab (reader, objfile);
 
-  /* Add the dynamic symbols.  */
-
-  read_dbx_dynamic_symtab (reader, objfile);
-
   /* Install any minimal symbols that have been collected as the current
      minimal symbols for this objfile.  */
 
@@ -976,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 (minimal_symbol_reader &reader,
-			 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 (reader, 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);
-      reader.record (name, address, mst_solib_trampoline);
-    }
-
-  do_cleanups (back_to);
-}
-
 static CORE_ADDR
 find_stab_function_addr (char *namestring, const char *filename,
 			 struct objfile *objfile)
@@ -2688,14 +2527,6 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
      source file.  Used to detect the SunPRO solaris compiler.  */
   static int n_opt_found;
 
-  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.  */
 
@@ -2751,8 +2582,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;
 	}
@@ -2774,13 +2604,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;
@@ -2793,13 +2617,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)
 	{
@@ -2894,8 +2712,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);
@@ -3113,14 +2930,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 3d21f62..6261e92 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -574,15 +574,11 @@ 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_FREEBSD,
+  GDB_OSABI_NETBSD,
+  GDB_OSABI_OPENBSD,
   GDB_OSABI_WINCE,
   GDB_OSABI_GO32,
-  GDB_OSABI_HPUX_ELF,
-  GDB_OSABI_HPUX_SOM,
   GDB_OSABI_QNXNTO,
   GDB_OSABI_CYGWIN,
   GDB_OSABI_AIX,
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 4329f97..4c91cfc 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -334,7 +334,7 @@ fbsd_get_syscall_number (struct gdbarch *gdbarch,
   internal_error (__FILE__, __LINE__, _("fbsd_get_sycall_number called"));
 }
 
-/* To be called from GDB_OSABI_FREEBSD_ELF handlers. */
+/* To be called from GDB_OSABI_FREEBSD handlers. */
 
 void
 fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
diff --git a/gdb/hppa-nbsd-tdep.c b/gdb/hppa-nbsd-tdep.c
index 6165bb5..c48dae4 100644
--- a/gdb/hppa-nbsd-tdep.c
+++ b/gdb/hppa-nbsd-tdep.c
@@ -213,6 +213,6 @@ extern initialize_file_ftype _initialize_hppanbsd_tdep;
 void
 _initialize_hppanbsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_NETBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_NETBSD,
 			  hppanbsd_init_abi);
 }
diff --git a/gdb/hppa-obsd-tdep.c b/gdb/hppa-obsd-tdep.c
index 65364fe..fe1e4f7 100644
--- a/gdb/hppa-obsd-tdep.c
+++ b/gdb/hppa-obsd-tdep.c
@@ -166,30 +166,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,
+  gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_OPENBSD,
 			  hppaobsd_init_abi);
 }
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 4bb49ed..65a49fd 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2454,21 +2454,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;
 
@@ -3062,14 +3047,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/i386-bsd-tdep.c b/gdb/i386-bsd-tdep.c
index 15809b3..af4b830 100644
--- a/gdb/i386-bsd-tdep.c
+++ b/gdb/i386-bsd-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/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c
index a08523a..236f49b 100644
--- a/gdb/i386-fbsd-tdep.c
+++ b/gdb/i386-fbsd-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,
+  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_FREEBSD,
 			  i386fbsd4_init_abi);
 }
diff --git a/gdb/i386-nbsd-tdep.c b/gdb/i386-nbsd-tdep.c
index f73e5c1..088eb91 100644
--- a/gdb/i386-nbsd-tdep.c
+++ b/gdb/i386-nbsd-tdep.c
@@ -322,6 +322,6 @@ extern initialize_file_ftype _initialize_i386nbsd_tdep;
 void
 _initialize_i386nbsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD,
 			  i386nbsdelf_init_abi);
 }
diff --git a/gdb/i386-obsd-tdep.c b/gdb/i386-obsd-tdep.c
index 08becfa..5495c54 100644
--- a/gdb/i386-obsd-tdep.c
+++ b/gdb/i386-obsd-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,30 +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)
-{
-  /* 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
@@ -507,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);
+  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_OPENBSD,
+			  i386obsd_init_abi);
 }
diff --git a/gdb/m68k-bsd-tdep.c b/gdb/m68k-bsd-tdep.c
index 0d2a4e9..349774d 100644
--- a/gdb/m68k-bsd-tdep.c
+++ b/gdb/m68k-bsd-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);
+  gdbarch_register_osabi (bfd_arch_m68k, 0, GDB_OSABI_NETBSD,
+			  m68kbsd_init_abi);
 }
diff --git a/gdb/mips-nbsd-tdep.c b/gdb/mips-nbsd-tdep.c
index 2d7cd82..7934c8d 100644
--- a/gdb/mips-nbsd-tdep.c
+++ b/gdb/mips-nbsd-tdep.c
@@ -380,6 +380,6 @@ extern initialize_file_ftype _initialize_mipsnbsd_tdep;
 void
 _initialize_mipsnbsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_NETBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_NETBSD,
 			  mipsnbsd_init_abi);
 }
diff --git a/gdb/mips64-obsd-tdep.c b/gdb/mips64-obsd-tdep.c
index df8ec0f..5209ab4 100644
--- a/gdb/mips64-obsd-tdep.c
+++ b/gdb/mips64-obsd-tdep.c
@@ -165,6 +165,6 @@ void _initialize_mips64obsd_tdep (void);
 void
 _initialize_mips64obsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_OPENBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_OPENBSD,
 			  mips64obsd_init_abi);
 }
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 8b44a85..69d95f6 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -64,15 +64,11 @@ 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 },
   { "WindowsCE", NULL },
   { "DJGPP", NULL },
-  { "HP-UX/ELF", NULL },
-  { "HP-UX/SOM", NULL },
   { "QNX-Neutrino", NULL },
   { "Cygwin", NULL },
   { "AIX", NULL },
@@ -482,11 +478,11 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
 	      break;
 
 	    case GNU_ABI_TAG_FREEBSD:
-	      *osabi = GDB_OSABI_FREEBSD_ELF;
+	      *osabi = GDB_OSABI_FREEBSD;
 	      break;
 
 	    case GNU_ABI_TAG_NETBSD:
-	      *osabi = GDB_OSABI_NETBSD_ELF;
+	      *osabi = GDB_OSABI_NETBSD;
 	      break;
 
 	    default:
@@ -501,7 +497,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
 		      NT_FREEBSD_ABI_TAG))
 	{
 	  /* There is no need to check the version yet.  */
-	  *osabi = GDB_OSABI_FREEBSD_ELF;
+	  *osabi = GDB_OSABI_FREEBSD;
 	  return;
 	}
 
@@ -513,7 +509,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
       && check_note (abfd, sect, note, &sectsize, "NetBSD", 4, NT_NETBSD_IDENT))
     {
       /* There is no need to check the version yet.  */
-      *osabi = GDB_OSABI_NETBSD_ELF;
+      *osabi = GDB_OSABI_NETBSD;
       return;
     }
 
@@ -523,14 +519,14 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
 		     NT_OPENBSD_IDENT))
     {
       /* There is no need to check the version yet.  */
-      *osabi = GDB_OSABI_OPENBSD_ELF;
+      *osabi = GDB_OSABI_OPENBSD;
       return;
     }
 
   /* .note.netbsdcore.procinfo notes, used by NetBSD.  */
   if (strcmp (name, ".note.netbsdcore.procinfo") == 0)
     {
-      *osabi = GDB_OSABI_NETBSD_ELF;
+      *osabi = GDB_OSABI_NETBSD;
       return;
     }
 }
@@ -547,6 +543,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
@@ -555,34 +552,27 @@ 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);
       break;
 
     case ELFOSABI_FREEBSD:
-      osabi = GDB_OSABI_FREEBSD_ELF;
+      osabi = GDB_OSABI_FREEBSD;
       break;
 
     case ELFOSABI_NETBSD:
-      osabi = GDB_OSABI_NETBSD_ELF;
+      osabi = GDB_OSABI_NETBSD;
       break;
 
     case ELFOSABI_SOLARIS:
       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;
@@ -595,7 +585,7 @@ generic_elf_osabi_sniffer (bfd *abfd)
 	 header to "brand" their ELF binaries in FreeBSD 3.x.  */
       if (memcmp (&elf_elfheader (abfd)->e_ident[8],
 		  "FreeBSD", sizeof ("FreeBSD")) == 0)
-	osabi = GDB_OSABI_FREEBSD_ELF;
+	osabi = GDB_OSABI_FREEBSD;
     }
 
   return osabi;
diff --git a/gdb/ppc-fbsd-tdep.c b/gdb/ppc-fbsd-tdep.c
index 0e5ead6..3d2b578 100644
--- a/gdb/ppc-fbsd-tdep.c
+++ b/gdb/ppc-fbsd-tdep.c
@@ -343,11 +343,10 @@ void _initialize_ppcfbsd_tdep (void);
 void
 _initialize_ppcfbsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_FREEBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_FREEBSD,
 			  ppcfbsd_init_abi);
-  gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64,
-			  GDB_OSABI_FREEBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_FREEBSD,
 			  ppcfbsd_init_abi);
-  gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_FREEBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_FREEBSD,
 			  ppcfbsd_init_abi);
 }
diff --git a/gdb/ppc-nbsd-tdep.c b/gdb/ppc-nbsd-tdep.c
index a730ebd..331540d 100644
--- a/gdb/ppc-nbsd-tdep.c
+++ b/gdb/ppc-nbsd-tdep.c
@@ -195,7 +195,7 @@ void _initialize_ppcnbsd_tdep (void);
 void
 _initialize_ppcnbsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_NETBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_NETBSD,
 			  ppcnbsd_init_abi);
 
   /* Avoid initializing the register offsets again if they were
diff --git a/gdb/ppc-obsd-tdep.c b/gdb/ppc-obsd-tdep.c
index f61dd24..efc785f 100644
--- a/gdb/ppc-obsd-tdep.c
+++ b/gdb/ppc-obsd-tdep.c
@@ -262,33 +262,15 @@ 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,
+  gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_OPENBSD,
 			  ppcobsd_init_abi);
-  gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_OPENBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_OPENBSD,
 			  ppcobsd_init_abi);
 
   /* Avoid initializing the register offsets again if they were
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 1c26e1e..8c54276 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -6530,8 +6530,7 @@ 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_NETBSD:
     case GDB_OSABI_UNKNOWN:
       set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
diff --git a/gdb/sh-nbsd-tdep.c b/gdb/sh-nbsd-tdep.c
index b5c70ef..41fc8a2 100644
--- a/gdb/sh-nbsd-tdep.c
+++ b/gdb/sh-nbsd-tdep.c
@@ -71,31 +71,14 @@ 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,
+  gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD,
 			  shnbsd_init_abi);
-  gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD,
 			  shnbsd_init_abi);
 }
diff --git a/gdb/solib.c b/gdb/solib.c
index db370e9..c4b2cdc 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1240,29 +1240,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-nbsd-tdep.c b/gdb/sparc-nbsd-tdep.c
index 7fa384d..b1427a3 100644
--- a/gdb/sparc-nbsd-tdep.c
+++ b/gdb/sparc-nbsd-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);
+  gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD,
+			  sparc32nbsd_init_abi);
 }
diff --git a/gdb/sparc-obsd-tdep.c b/gdb/sparc-obsd-tdep.c
index 21c8d6a..cbf11c9 100644
--- a/gdb/sparc-obsd-tdep.c
+++ b/gdb/sparc-obsd-tdep.c
@@ -235,7 +235,7 @@ static void
 sparc32obsd_init_abi (struct gdbarch_info info, struct gdbarch *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);
 
@@ -253,6 +253,6 @@ void _initialize_sparc32obsd_tdep (void);
 void
 _initialize_sparc32obsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_OPENBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_OPENBSD,
 			  sparc32obsd_init_abi);
 }
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 6785e01..704c004 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -246,8 +246,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/sparc64-fbsd-tdep.c b/gdb/sparc64-fbsd-tdep.c
index 27ca52e..7ce2126 100644
--- a/gdb/sparc64-fbsd-tdep.c
+++ b/gdb/sparc64-fbsd-tdep.c
@@ -248,5 +248,5 @@ void
 _initialize_sparc64fbsd_tdep (void)
 {
   gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
-			  GDB_OSABI_FREEBSD_ELF, sparc64fbsd_init_abi);
+			  GDB_OSABI_FREEBSD, sparc64fbsd_init_abi);
 }
diff --git a/gdb/sparc64-nbsd-tdep.c b/gdb/sparc64-nbsd-tdep.c
index 1abb721..71d40d5 100644
--- a/gdb/sparc64-nbsd-tdep.c
+++ b/gdb/sparc64-nbsd-tdep.c
@@ -276,5 +276,5 @@ void
 _initialize_sparc64nbsd_tdep (void)
 {
   gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
-			  GDB_OSABI_NETBSD_ELF, sparc64nbsd_init_abi);
+			  GDB_OSABI_NETBSD, sparc64nbsd_init_abi);
 }
diff --git a/gdb/sparc64-obsd-tdep.c b/gdb/sparc64-obsd-tdep.c
index a90ae1d..1a92644 100644
--- a/gdb/sparc64-obsd-tdep.c
+++ b/gdb/sparc64-obsd-tdep.c
@@ -448,5 +448,5 @@ void
 _initialize_sparc64obsd_tdep (void)
 {
   gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
-			  GDB_OSABI_OPENBSD_ELF, sparc64obsd_init_abi);
+			  GDB_OSABI_OPENBSD, sparc64obsd_init_abi);
 }
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index d72db14..47e489f 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 bba8a71..ba6883d 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/vax-nbsd-tdep.c b/gdb/vax-nbsd-tdep.c
index 1302dcd..f6c8208 100644
--- a/gdb/vax-nbsd-tdep.c
+++ b/gdb/vax-nbsd-tdep.c
@@ -41,6 +41,6 @@ void _initialize_vaxnbsd_tdep (void);
 void
 _initialize_vaxnbsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_vax, 0, GDB_OSABI_NETBSD_ELF,
+  gdbarch_register_osabi (bfd_arch_vax, 0, GDB_OSABI_NETBSD,
 			  vaxnbsd_elf_init_abi);
 }
diff --git a/gdb/vax-obsd-tdep.c b/gdb/vax-obsd-tdep.c
deleted file mode 100644
index ee48ac6..0000000
--- a/gdb/vax-obsd-tdep.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Target-dependent code for OpenBSD/vax.
-
-   Copyright (C) 2005-2016 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include "defs.h"
-#include "arch-utils.h"
-#include "frame.h"
-#include "frame-unwind.h"
-#include "osabi.h"
-#include "symtab.h"
-#include "trad-frame.h"
-
-#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.5


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] Don't allow whitespace in enum values of enum commands (Re: [PATCH] Avoid spaces in osabi names)
  2016-03-07 19:02 [PATCH] Avoid spaces in osabi names Pedro Alves
  2016-03-07 19:12 ` Simon Marchi
  2016-03-08 20:59 ` [PATCH] Avoid spaces in osabi names Joel Brobecker
@ 2016-12-09 16:57 ` Pedro Alves
  2 siblings, 0 replies; 10+ messages in thread
From: Pedro Alves @ 2016-12-09 16:57 UTC (permalink / raw)
  To: GDB Patches

Now that we don't have spaces in names anymore (and all-architectures.exp
is in, and a.out support is gone too), how about this patch below, to make
sure we don't introduce the problem in any other enum command?

On 03/07/2016 07: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.

This is the patch that I had tried back then.  I retested it on current
master, with --enable-targets=all (on x86_64 Fedora), and there are
no regressions.

From 44f14ec124d582f9fa5baa89c696fe4f23a4bb4e Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 7 Mar 2016 18:43:29 +0000
Subject: [PATCH] Don't allow whitespace in enum values of enum commands

Enum values with spaces don't work, so make sure we can't create them.

Ref: https://sourceware.org/ml/gdb-patches/2016-03/msg00116.html

gdb/ChangeLog:
2016-12-09  Pedro Alves  <palves@redhat.com>

	* cli/cli-decode.c (add_setshow_enum_cmd): Assert the enum values
	do not include whitespace.
	(complete_on_enum): Likewise.
---
 gdb/cli/cli-decode.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index acc9c42..65bfb16 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -480,8 +480,9 @@ add_setshow_cmd_full (const char *name,
 
 /* Add element named NAME to command list LIST (the list for set or
    some sublist thereof).  CLASS is as in add_cmd.  ENUMLIST is a list
-   of strings which may follow NAME.  VAR is address of the variable
-   which will contain the matching string (from ENUMLIST).  */
+   of strings which may follow NAME.  The list elements must not
+   include spaces.  VAR is address of the variable which will contain
+   the matching string (from ENUMLIST).  */
 
 void
 add_setshow_enum_cmd (const char *name,
@@ -498,6 +499,10 @@ add_setshow_enum_cmd (const char *name,
 {
   struct cmd_list_element *c;
 
+  /* Enum values must not include whitespace.  */
+  for (size_t i = 0; enumlist[i] != NULL; i++)
+    gdb_assert (strpbrk (enumlist[i], " \t\n") == NULL);
+
   add_setshow_cmd_full (name, theclass, var_enum, var,
 			set_doc, show_doc, help_doc,
 			set_func, show_func,
@@ -1866,6 +1871,9 @@ complete_on_enum (const char *const *enumlist,
       {
 	char *match;
 
+	/* Enum values must not include whitespace.  */
+	gdb_assert (strpbrk (name, " \t\n") == NULL);
+
 	match = (char *) xmalloc (strlen (word) + strlen (name) + 1);
 	if (word == text)
 	  strcpy (match, name);
-- 
2.5.5


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-12-09 16:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-07 19:02 [PATCH] Avoid spaces in osabi names Pedro Alves
2016-03-07 19:12 ` Simon Marchi
2016-03-09  1:34   ` [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names) Pedro Alves
2016-04-19 19:26     ` John Baldwin
2016-04-20 18:50       ` Joel Brobecker
2016-04-22 13:14         ` Pedro Alves
2016-12-09 16:25           ` [pushed] " Pedro Alves
2016-03-08 20:59 ` [PATCH] Avoid spaces in osabi names Joel Brobecker
2016-03-09 15:58   ` Pedro Alves
2016-12-09 16:57 ` [PATCH] Don't allow whitespace in enum values of enum commands (Re: [PATCH] Avoid spaces in osabi names) Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).