This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: mark dot kettenis at xs4all dot nl (Mark Kettenis)
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 30 Oct 2007 22:30:28 +0100 (CET)
- Subject: Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
Mark Kettenis wrote:
> > On vax, both NetBSD and OpenBSD want to install an OSABI handler,
> > so this *is* a problem. However, the NetBSD OSABI handler doesn't
> > actually do anything -- do you know the status of NetBSD/vax?
>
> NetBSD/vax has been using ELF since NetBSD 1.5 or 1.6. I guess this
> means NetBSD/vax a.out could be dropped.
It appears there was no osabi sniffer installed that would ever return
GDB_OSABI_NETBSD_AOUT on the NetBSD/vax target, so removing the (empty)
OSABI handler should actually not change the behaviour at all ...
>
> > If we can resolve the vax question, and indeed drop a.out support
> > for either NetBSD/i386 or OpenBSD/i386, this would solve the problem
> > as well.
>
> Probably both can be dropped. NetBSD/i386 started using ELF before
> OpenBSD/i386, but I have no problem with dropping OpenBSD/i386 a.out
> support.
The following patch is the minimal solution to the re-defined handler
problem, by dropping the (obsolete) NetBSD/vax a.out handler, and by
removing OpenBSD/i386 a.out support. (If you prefer, I'm certainly
fine with removing NetBSD/i386 a.out as well ...)
Would this be OK?
Bye,
Ulrich
ChangeLog:
* i386obsd-tdep.c (i386obsd_aout_supply_regset): Remove.
(i386obsd_aout_regset_from_core_section): Likewise.
(i386obsd_aout_init_abi): Likewise.
(_initialize_i386obsd_tdep): Do not register i386obsd_aout_init_abi.
(GDB_OSABI_OPENBSD_AOUT): Do not define.
* vaxnbsd-tdep.c (vaxnbsd_aout_init_abi): Remove.
(_initialize_vaxnbsd_tdep): Do not register vaxnbsd_aout_init_abi.
diff -urNp gdb-orig/gdb/i386obsd-tdep.c gdb-head/gdb/i386obsd-tdep.c
--- gdb-orig/gdb/i386obsd-tdep.c 2007-10-26 01:31:07.000000000 +0200
+++ gdb-head/gdb/i386obsd-tdep.c 2007-10-30 20:03:09.012085344 +0100
@@ -136,42 +136,6 @@ static int i386obsd_r_reg_offset[] =
14 * 4, /* %fs */
15 * 4 /* %gs */
};
-
-static void
-i386obsd_aout_supply_regset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *regs, size_t len)
-{
- const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
- const gdb_byte *gregs = 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_regset_from_core_section (struct gdbarch *gdbarch,
- const char *sect_name,
- size_t sect_size)
-{
- 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. */
-
- if (strcmp (sect_name, ".reg") == 0
- && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE)
- {
- if (tdep->gregset == NULL)
- tdep->gregset =
- regset_alloc (gdbarch, i386obsd_aout_supply_regset, NULL);
- return tdep->gregset;
- }
-
- return NULL;
-}
/* Sigtramp routine location for OpenBSD 3.1 and earlier releases. */
@@ -474,18 +438,6 @@ i386obsd_init_abi (struct gdbarch_info i
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_regset_from_core_section
- (gdbarch, i386obsd_aout_regset_from_core_section);
-}
-
/* OpenBSD ELF. */
static void
@@ -511,14 +463,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);
}
diff -urNp gdb-orig/gdb/vaxnbsd-tdep.c gdb-head/gdb/vaxnbsd-tdep.c
--- gdb-orig/gdb/vaxnbsd-tdep.c 2007-08-23 20:08:47.000000000 +0200
+++ gdb-head/gdb/vaxnbsd-tdep.c 2007-10-30 19:59:53.808570506 +0100
@@ -26,13 +26,6 @@
#include "gdb_string.h"
-/* NetBSD a.out. */
-
-static void
-vaxnbsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
-}
-
/* NetBSD ELF. */
static void
@@ -50,8 +43,6 @@ void _initialize_vaxnbsd_tdep (void);
void
_initialize_vaxnbsd_tdep (void)
{
- gdbarch_register_osabi (bfd_arch_vax, 0, GDB_OSABI_NETBSD_AOUT,
- vaxnbsd_aout_init_abi);
gdbarch_register_osabi (bfd_arch_vax, 0, GDB_OSABI_NETBSD_ELF,
vaxnbsd_elf_init_abi);
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com