Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
@ 2007-10-26  1:18 Ulrich Weigand
  2007-10-26  9:21 ` Mark Kettenis
  0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2007-10-26  1:18 UTC (permalink / raw)
  To: gdb-patches

Hello,

this patch attempts to address a somewhat unfortunate situation
relating to OpenBSD/a.out.  

i386obsd-tdep.c contains this FIXME:

  /* 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

In an --enable-targets=all build, this has the effect that two OSABI
sniffers for the (numerically) same OSABI are registered, leading to
an internal compiler error.

Now, assuming the comment above is correct, the problem is not really
solvable; however, we can at least try to not cause it to break an
--enable-targets=all build for everybody else.

This patch introduces a new enum value GDB_OSABI_OPENBSD_AOUT, and
duplicates the sniffers for OpenBSD/a.out and NetBSD/a.out.  Now,
as the sniffers test for the same features, it is somewhat unpredictable
whether a matching binary will be detected as OpenBSD or NetBSD.

But at least --enable-targets=all now works for all other targets,
and even for OpenBSD and NetBSD you should now at least be able to
manually select the proper version via "set osabi".

For single-target OpenBSD or NetBSD builds, everything should
continue to work as today.

Suggestions for a better solution to this problem are welcome!

Bye,
Ulrich



ChangeLog:

	* defs.h (enum gdb_osabi): Add GDB_OSABI_OPENBSD_AOUT.
	* osabi.c (gdb_osabi_name): Likewise.
	
	* i386bsd-tdep.c (i386bsd_aout_osabi_sniffer): Remove.
	(i386bsd_core_osabi_sniffer): Likewise.
	(_initialize_i386bsd_tdep): Likewise.
	* i386fbsd-tdep.c (i386fbsd_aout_osabi_sniffer): New function.
	(_initialize_i386fbsd_tdep): Register it.
	* i386nbsd-tdep.c (i386nbsd_aout_osabi_sniffer): New function.
	(i386nbsd_core_osabi_sniffer): New function.
	(_initialize_i386nbsd_tdep): Register them.
	* i386obsd-tdep.c (i386obsd_aout_osabi_sniffer): New function.
	(i386obsd_core_osabi_sniffer): New function.
	(_initialize_i386obsd_tdep): Register them.

	* i386fbsd-tdep.c: Include "gdb_string.h".
	* Makefile.in: Update dependencies.

	* vaxobsd-tdep.c (GDB_OSABI_OPENBSD_AOUT): Do not define.


diff -urNp gdb-orig/gdb/defs.h gdb-head/gdb/defs.h
--- gdb-orig/gdb/defs.h	2007-10-26 01:31:07.081304189 +0200
+++ gdb-head/gdb/defs.h	2007-10-26 00:52:44.155928505 +0200
@@ -954,6 +954,7 @@ enum gdb_osabi
   GDB_OSABI_FREEBSD_ELF,
   GDB_OSABI_NETBSD_AOUT,
   GDB_OSABI_NETBSD_ELF,
+  GDB_OSABI_OPENBSD_AOUT,
   GDB_OSABI_OPENBSD_ELF,
   GDB_OSABI_WINCE,
   GDB_OSABI_GO32,
diff -urNp gdb-orig/gdb/i386bsd-tdep.c gdb-head/gdb/i386bsd-tdep.c
--- gdb-orig/gdb/i386bsd-tdep.c	2007-10-26 01:31:07.086303468 +0200
+++ gdb-head/gdb/i386bsd-tdep.c	2007-10-26 00:52:44.159927928 +0200
@@ -85,39 +85,3 @@ i386bsd_init_abi (struct gdbarch_info in
   tdep->sc_num_regs = ARRAY_SIZE (i386bsd_sc_reg_offset);
 }
 
-\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 -urNp gdb-orig/gdb/i386fbsd-tdep.c gdb-head/gdb/i386fbsd-tdep.c
--- gdb-orig/gdb/i386fbsd-tdep.c	2007-10-26 01:31:07.091302747 +0200
+++ gdb-head/gdb/i386fbsd-tdep.c	2007-10-26 01:30:02.079837285 +0200
@@ -24,6 +24,7 @@
 #include "regcache.h"
 
 #include "gdb_assert.h"
+#include "gdb_string.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
@@ -153,6 +154,15 @@ i386fbsdaout_init_abi (struct gdbarch_in
   bsd_uthread_set_collect_uthread (gdbarch, i386fbsd_collect_uthread);
 }
 
+static enum gdb_osabi
+i386fbsd_aout_osabi_sniffer (bfd *abfd)
+{
+  if (strcmp (bfd_get_target (abfd), "a.out-i386-freebsd") == 0)
+    return GDB_OSABI_FREEBSD_AOUT;
+
+  return GDB_OSABI_UNKNOWN;
+}
+
 static void
 i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -227,6 +237,9 @@ void _initialize_i386fbsd_tdep (void);
 void
 _initialize_i386fbsd_tdep (void)
 {
+  gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour,
+				  i386fbsd_aout_osabi_sniffer);
+
   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,
diff -urNp gdb-orig/gdb/i386nbsd-tdep.c gdb-head/gdb/i386nbsd-tdep.c
--- gdb-orig/gdb/i386nbsd-tdep.c	2007-10-26 01:31:07.096302026 +0200
+++ gdb-head/gdb/i386nbsd-tdep.c	2007-10-26 00:52:44.168926630 +0200
@@ -254,6 +254,24 @@ i386nbsdaout_init_abi (struct gdbarch_in
     (gdbarch, i386nbsd_aout_regset_from_core_section);
 }
 
+static enum gdb_osabi
+i386nbsd_aout_osabi_sniffer (bfd *abfd)
+{
+  if (strcmp (bfd_get_target (abfd), "a.out-i386-netbsd") == 0)
+    return GDB_OSABI_NETBSD_AOUT;
+
+  return GDB_OSABI_UNKNOWN;
+}
+
+static enum gdb_osabi
+i386nbsd_core_osabi_sniffer (bfd *abfd)
+{
+  if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
+    return GDB_OSABI_NETBSD_AOUT;
+
+  return GDB_OSABI_UNKNOWN;
+}
+
 /* NetBSD ELF.  */
 
 static void
@@ -278,6 +296,11 @@ i386nbsdelf_init_abi (struct gdbarch_inf
 void
 _initialize_i386nbsd_tdep (void)
 {
+  gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour,
+				  i386nbsd_aout_osabi_sniffer);
+  gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_unknown_flavour,
+				  i386nbsd_core_osabi_sniffer);
+
   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_AOUT,
 			  i386nbsdaout_init_abi);
   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_ELF,
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.101301305 +0200
+++ gdb-head/gdb/i386obsd-tdep.c	2007-10-26 00:52:44.173925909 +0200
@@ -486,6 +486,29 @@ i386obsd_aout_init_abi (struct gdbarch_i
     (gdbarch, i386obsd_aout_regset_from_core_section);
 }
 
+/* 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.  */
+
+static enum gdb_osabi
+i386obsd_aout_osabi_sniffer (bfd *abfd)
+{
+  if (strcmp (bfd_get_target (abfd), "a.out-i386-netbsd") == 0)
+    return GDB_OSABI_OPENBSD_AOUT;
+
+  return GDB_OSABI_UNKNOWN;
+}
+
+static enum gdb_osabi
+i386obsd_core_osabi_sniffer (bfd *abfd)
+{
+  if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
+    return GDB_OSABI_OPENBSD_AOUT;
+
+  return GDB_OSABI_UNKNOWN;
+}
+
 /* OpenBSD ELF.  */
 
 static void
@@ -511,11 +534,10 @@ 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_sniffer (bfd_arch_i386, bfd_target_aout_flavour,
+				  i386obsd_aout_osabi_sniffer);
+  gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_unknown_flavour,
+				  i386obsd_core_osabi_sniffer);
 
   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_OPENBSD_AOUT,
 			  i386obsd_aout_init_abi);
diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in	2007-10-26 01:30:45.779192703 +0200
+++ gdb-head/gdb/Makefile.in	2007-10-26 01:30:29.308033904 +0200
@@ -2179,8 +2179,8 @@ i386fbsd-nat.o: i386fbsd-nat.c $(defs_h)
 	$(target_h) $(fbsd_nat_h) $(i386_tdep_h) $(i386bsd_nat_h) \
 	$(bsd_kvm_h)
 i386fbsd-tdep.o: i386fbsd-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \
-	$(osabi_h) $(regcache_h) $(gdb_assert_h) $(i386_tdep_h) \
-	$(i387_tdep_h) $(bsd_uthread_h) $(solib_svr4_h)
+	$(osabi_h) $(regcache_h) $(gdb_assert_h) $(gdb_string_h) \
+	$(i386_tdep_h) $(i387_tdep_h) $(bsd_uthread_h) $(solib_svr4_h)
 i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \
 	$(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) \
 	$(gnu_nat_h) $(i387_tdep_h) $(gregset_h)
diff -urNp gdb-orig/gdb/osabi.c gdb-head/gdb/osabi.c
--- gdb-orig/gdb/osabi.c	2007-10-26 01:31:07.106300584 +0200
+++ gdb-head/gdb/osabi.c	2007-10-26 00:52:44.178925188 +0200
@@ -59,6 +59,7 @@ static const char * const gdb_osabi_name
   "FreeBSD ELF",
   "NetBSD a.out",
   "NetBSD ELF",
+  "OpenBSD a.out",
   "OpenBSD ELF",
   "Windows CE",
   "DJGPP",
diff -urNp gdb-orig/gdb/vaxobsd-tdep.c gdb-head/gdb/vaxobsd-tdep.c
--- gdb-orig/gdb/vaxobsd-tdep.c	2007-10-26 01:31:07.111299864 +0200
+++ gdb-head/gdb/vaxobsd-tdep.c	2007-10-26 00:52:44.182924611 +0200
@@ -162,7 +162,6 @@ vaxobsd_init_abi (struct gdbarch_info in
    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)
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-10-26  1:18 [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem Ulrich Weigand
@ 2007-10-26  9:21 ` Mark Kettenis
  2007-10-29 20:27   ` Ulrich Weigand
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2007-10-26  9:21 UTC (permalink / raw)
  To: uweigand; +Cc: gdb-patches

> Date: Fri, 26 Oct 2007 03:17:38 +0200 (CEST)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> 
> Hello,
> 
> this patch attempts to address a somewhat unfortunate situation
> relating to OpenBSD/a.out.  
> 
> i386obsd-tdep.c contains this FIXME:
> 
>   /* 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
> 
> In an --enable-targets=all build, this has the effect that two OSABI
> sniffers for the (numerically) same OSABI are registered, leading to
> an internal compiler error.

The last OpenBSD/i386 release that used a.out was OpenBSD 3.3, which
was released more than four years ago.  I have no problem with
dropping a.out support for OpenBSD/i386 if that makes things easier.

However, OpenBSD/vax, OpenBSD/m68k and OpenBSD/m88k are still a.out,
so parts of your diff might still be required (didn't look at the
details of your diff yet).

Mark


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

* Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-10-26  9:21 ` Mark Kettenis
@ 2007-10-29 20:27   ` Ulrich Weigand
  2007-10-29 22:53     ` Mark Kettenis
  0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2007-10-29 20:27 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Mark Kettenis wrote:

> The last OpenBSD/i386 release that used a.out was OpenBSD 3.3, which
> was released more than four years ago.  I have no problem with
> dropping a.out support for OpenBSD/i386 if that makes things easier.
> 
> However, OpenBSD/vax, OpenBSD/m68k and OpenBSD/m88k are still a.out,
> so parts of your diff might still be required (didn't look at the
> details of your diff yet).

The problem occurs whenever we want to support both OpenBSD-a.out
and NetBSD-a.out on the same platform, and they both want to install
(different) OSABI handlers.

On m88k, we don't support NetBSD at all, so this is no problem.

On m68k, we support both NetBSD and OpenBSD, but they use the
same gdbarch structure (with no OSABI handlers at all), so this
is no problem (currently) either.

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?

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.

Otherwise, the suggestion implemented in my patch would be to at
least offer two separate OSABI settings for the two operating
systems; this will at least enable users to manually select the
correct OS, if it cannot be detected automatically ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-10-29 20:27   ` Ulrich Weigand
@ 2007-10-29 22:53     ` Mark Kettenis
  2007-10-30 21:36       ` Ulrich Weigand
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2007-10-29 22:53 UTC (permalink / raw)
  To: uweigand; +Cc: gdb-patches

> Date: Mon, 29 Oct 2007 21:19:07 +0100 (CET)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> 
> Mark Kettenis wrote:
> 
> > The last OpenBSD/i386 release that used a.out was OpenBSD 3.3, which
> > was released more than four years ago.  I have no problem with
> > dropping a.out support for OpenBSD/i386 if that makes things easier.
> > 
> > However, OpenBSD/vax, OpenBSD/m68k and OpenBSD/m88k are still a.out,
> > so parts of your diff might still be required (didn't look at the
> > details of your diff yet).
> 
> The problem occurs whenever we want to support both OpenBSD-a.out
> and NetBSD-a.out on the same platform, and they both want to install
> (different) OSABI handlers.
> 
> 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.

> 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.

Mark


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

* Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-10-29 22:53     ` Mark Kettenis
@ 2007-10-30 21:36       ` Ulrich Weigand
  2007-11-13 21:27         ` [ping] " Ulrich Weigand
  0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2007-10-30 21:36 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

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;
-}
 \f
 
 /* 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


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

* [ping] Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-10-30 21:36       ` Ulrich Weigand
@ 2007-11-13 21:27         ` Ulrich Weigand
  2007-11-14 22:22           ` Mark Kettenis
  0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2007-11-13 21:27 UTC (permalink / raw)
  To: mark.kettenis; +Cc: gdb-patches

Mark,

do you think this patch would be OK?
http://sourceware.org/ml/gdb-patches/2007-10/msg00831.html

I'd like to resolve this issue, so we can provide --enable-target=all
support.  As I said, I don't really have any opinion what the best
solution of the OpenBSD/a.out vs. NetBSD/a.out problem is; if you
have some other suggestion, please let me know.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [ping] Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-11-13 21:27         ` [ping] " Ulrich Weigand
@ 2007-11-14 22:22           ` Mark Kettenis
  2007-11-14 22:30             ` Mark Kettenis
  2007-11-15  1:05             ` Ulrich Weigand
  0 siblings, 2 replies; 11+ messages in thread
From: Mark Kettenis @ 2007-11-14 22:22 UTC (permalink / raw)
  To: uweigand; +Cc: gdb-patches

> Date: Tue, 13 Nov 2007 22:27:02 +0100 (CET)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> 
> Mark,
> 
> do you think this patch would be OK?
> http://sourceware.org/ml/gdb-patches/2007-10/msg00831.html
> 
> I'd like to resolve this issue, so we can provide --enable-target=all
> support.  As I said, I don't really have any opinion what the best
> solution of the OpenBSD/a.out vs. NetBSD/a.out problem is; if you
> have some other suggestion, please let me know.

Sorry; I didn't have the time to test this diff until now.
Unfortunately it breaks OpenBSD/i386.  The problem is that
OpenBSD/i386 still uses a core file format that's classified as NetBSD
a.out.  NetBSD doesn't use this format anymore, so I think the
solution is to sacrifice NetBSD/i386 a.out instead of OpenBSD/i386
a.out.

Mark


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

* Re: [ping] Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-11-14 22:22           ` Mark Kettenis
@ 2007-11-14 22:30             ` Mark Kettenis
  2007-11-15  1:05             ` Ulrich Weigand
  1 sibling, 0 replies; 11+ messages in thread
From: Mark Kettenis @ 2007-11-14 22:30 UTC (permalink / raw)
  To: uweigand, gdb-patches

> Date: Wed, 14 Nov 2007 23:21:43 +0100 (CET)
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
> 
> > Date: Tue, 13 Nov 2007 22:27:02 +0100 (CET)
> > From: "Ulrich Weigand" <uweigand@de.ibm.com>
> > 
> > Mark,
> > 
> > do you think this patch would be OK?
> > http://sourceware.org/ml/gdb-patches/2007-10/msg00831.html
> > 
> > I'd like to resolve this issue, so we can provide --enable-target=all
> > support.  As I said, I don't really have any opinion what the best
> > solution of the OpenBSD/a.out vs. NetBSD/a.out problem is; if you
> > have some other suggestion, please let me know.
> 
> Sorry; I didn't have the time to test this diff until now.
> Unfortunately it breaks OpenBSD/i386.  The problem is that
> OpenBSD/i386 still uses a core file format that's classified as NetBSD
> a.out.  NetBSD doesn't use this format anymore, so I think the
> solution is to sacrifice NetBSD/i386 a.out instead of OpenBSD/i386
> a.out.

Oh, btw, the vax bits are ok with me.


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

* Re: [ping] Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-11-14 22:22           ` Mark Kettenis
  2007-11-14 22:30             ` Mark Kettenis
@ 2007-11-15  1:05             ` Ulrich Weigand
  2007-11-16 23:29               ` Mark Kettenis
  1 sibling, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2007-11-15  1:05 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Mark Kettenis wrote:

> Sorry; I didn't have the time to test this diff until now.
> Unfortunately it breaks OpenBSD/i386.  The problem is that
> OpenBSD/i386 still uses a core file format that's classified as NetBSD
> a.out.  NetBSD doesn't use this format anymore, so I think the
> solution is to sacrifice NetBSD/i386 a.out instead of OpenBSD/i386
> a.out.

I see; that would work for me as well.  Something like the
following patch?

Thanks,
Ulrich


ChangeLog:

	* i386nbsd-tdep.c (i386nbsd_aout_supply_regset): Remove.
	(i386nbsd_aout_regset_from_core_section): Likewise.
	(i386nbsd_aout_init_abi): Likewise.
	(_initialize_i386nbsd_tdep): Do not register i386nbsd_aout_init_abi.

	* vaxnbsd-tdep.c (vaxnbsd_aout_init_abi): Remove.
	(_initialize_vaxnbsd_tdep): Do not register vaxnbsd_aout_init_abi.


diff -urNp gdb-orig/gdb/i386nbsd-tdep.c gdb-head/gdb/i386nbsd-tdep.c
--- gdb-orig/gdb/i386nbsd-tdep.c	2007-10-30 20:05:37.000000000 +0100
+++ gdb-head/gdb/i386nbsd-tdep.c	2007-11-15 00:38:14.504963834 +0100
@@ -56,41 +56,6 @@ static int i386nbsd_r_reg_offset[] =
   15 * 4			/* %gs */
 };
 
-static void
-i386nbsd_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);
-
-  gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
-
-  i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
-  i387_supply_fsave (regcache, regnum, (char *) regs + tdep->sizeof_gregset);
-}
-
-static const struct regset *
-i386nbsd_aout_regset_from_core_section (struct gdbarch *gdbarch,
-					const char *sect_name,
-					size_t sect_size)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
-  /* NetBSD 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, i386nbsd_aout_supply_regset, NULL);
-      return tdep->gregset;
-    }
-
-  return NULL;
-}
-
 /* Under NetBSD/i386, signal handler invocations can be identified by the
    designated code sequence that is used to return from a signal handler.
    In particular, the return address of a signal handler points to the
@@ -242,18 +207,6 @@ i386nbsd_init_abi (struct gdbarch_info i
   tdep->sc_num_regs = ARRAY_SIZE (i386nbsd_sc_reg_offset);
 }
 
-/* NetBSD a.out.  */
-
-static void
-i386nbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
-  i386nbsd_init_abi (info, gdbarch);
-
-  /* NetBSD a.out has a single register set.  */
-  set_gdbarch_regset_from_core_section
-    (gdbarch, i386nbsd_aout_regset_from_core_section);
-}
-
 /* NetBSD ELF.  */
 
 static void
@@ -278,8 +231,6 @@ i386nbsdelf_init_abi (struct gdbarch_inf
 void
 _initialize_i386nbsd_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_AOUT,
-			  i386nbsdaout_init_abi);
   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_ELF,
 			  i386nbsdelf_init_abi);
 }
diff -urNp gdb-orig/gdb/vaxnbsd-tdep.c gdb-head/gdb/vaxnbsd-tdep.c
--- gdb-orig/gdb/vaxnbsd-tdep.c	2007-10-30 20:28:29.000000000 +0100
+++ gdb-head/gdb/vaxnbsd-tdep.c	2007-11-15 00:37:04.223382898 +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


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

* Re: [ping] Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-11-15  1:05             ` Ulrich Weigand
@ 2007-11-16 23:29               ` Mark Kettenis
  2007-11-17  1:05                 ` Ulrich Weigand
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2007-11-16 23:29 UTC (permalink / raw)
  To: uweigand; +Cc: gdb-patches

> Date: Thu, 15 Nov 2007 02:05:39 +0100 (CET)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> 
> Mark Kettenis wrote:
> 
> > Sorry; I didn't have the time to test this diff until now.
> > Unfortunately it breaks OpenBSD/i386.  The problem is that
> > OpenBSD/i386 still uses a core file format that's classified as NetBSD
> > a.out.  NetBSD doesn't use this format anymore, so I think the
> > solution is to sacrifice NetBSD/i386 a.out instead of OpenBSD/i386
> > a.out.
> 
> I see; that would work for me as well.  Something like the
> following patch?

Works for me on OpenBSD/i386.

> ChangeLog:
> 
> 	* i386nbsd-tdep.c (i386nbsd_aout_supply_regset): Remove.
> 	(i386nbsd_aout_regset_from_core_section): Likewise.
> 	(i386nbsd_aout_init_abi): Likewise.
> 	(_initialize_i386nbsd_tdep): Do not register i386nbsd_aout_init_abi.
> 
> 	* vaxnbsd-tdep.c (vaxnbsd_aout_init_abi): Remove.
> 	(_initialize_vaxnbsd_tdep): Do not register vaxnbsd_aout_init_abi.
> 
> 
> diff -urNp gdb-orig/gdb/i386nbsd-tdep.c gdb-head/gdb/i386nbsd-tdep.c
> --- gdb-orig/gdb/i386nbsd-tdep.c	2007-10-30 20:05:37.000000000 +0100
> +++ gdb-head/gdb/i386nbsd-tdep.c	2007-11-15 00:38:14.504963834 +0100
> @@ -56,41 +56,6 @@ static int i386nbsd_r_reg_offset[] =
>    15 * 4			/* %gs */
>  };
>  
> -static void
> -i386nbsd_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);
> -
> -  gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
> -
> -  i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
> -  i387_supply_fsave (regcache, regnum, (char *) regs + tdep->sizeof_gregset);
> -}
> -
> -static const struct regset *
> -i386nbsd_aout_regset_from_core_section (struct gdbarch *gdbarch,
> -					const char *sect_name,
> -					size_t sect_size)
> -{
> -  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> -
> -  /* NetBSD 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, i386nbsd_aout_supply_regset, NULL);
> -      return tdep->gregset;
> -    }
> -
> -  return NULL;
> -}
> -
>  /* Under NetBSD/i386, signal handler invocations can be identified by the
>     designated code sequence that is used to return from a signal handler.
>     In particular, the return address of a signal handler points to the
> @@ -242,18 +207,6 @@ i386nbsd_init_abi (struct gdbarch_info i
>    tdep->sc_num_regs = ARRAY_SIZE (i386nbsd_sc_reg_offset);
>  }
>  
> -/* NetBSD a.out.  */
> -
> -static void
> -i386nbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> -{
> -  i386nbsd_init_abi (info, gdbarch);
> -
> -  /* NetBSD a.out has a single register set.  */
> -  set_gdbarch_regset_from_core_section
> -    (gdbarch, i386nbsd_aout_regset_from_core_section);
> -}
> -
>  /* NetBSD ELF.  */
>  
>  static void
> @@ -278,8 +231,6 @@ i386nbsdelf_init_abi (struct gdbarch_inf
>  void
>  _initialize_i386nbsd_tdep (void)
>  {
> -  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_AOUT,
> -			  i386nbsdaout_init_abi);
>    gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_ELF,
>  			  i386nbsdelf_init_abi);
>  }
> diff -urNp gdb-orig/gdb/vaxnbsd-tdep.c gdb-head/gdb/vaxnbsd-tdep.c
> --- gdb-orig/gdb/vaxnbsd-tdep.c	2007-10-30 20:28:29.000000000 +0100
> +++ gdb-head/gdb/vaxnbsd-tdep.c	2007-11-15 00:37:04.223382898 +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
> 


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

* Re: [ping] Re: [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem
  2007-11-16 23:29               ` Mark Kettenis
@ 2007-11-17  1:05                 ` Ulrich Weigand
  0 siblings, 0 replies; 11+ messages in thread
From: Ulrich Weigand @ 2007-11-17  1:05 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Mark Kettenis wrote:
> > Date: Thu, 15 Nov 2007 02:05:39 +0100 (CET)
> > From: "Ulrich Weigand" <uweigand@de.ibm.com>
> > 
> > I see; that would work for me as well.  Something like the
> > following patch?
> 
> Works for me on OpenBSD/i386.

Thanks for verifying this!   I've committed the patch now.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

end of thread, other threads:[~2007-11-17  1:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-26  1:18 [rfc] [7/9] Multi-target support: Fix GDB_OSABI_OPENBSD_AOUT problem Ulrich Weigand
2007-10-26  9:21 ` Mark Kettenis
2007-10-29 20:27   ` Ulrich Weigand
2007-10-29 22:53     ` Mark Kettenis
2007-10-30 21:36       ` Ulrich Weigand
2007-11-13 21:27         ` [ping] " Ulrich Weigand
2007-11-14 22:22           ` Mark Kettenis
2007-11-14 22:30             ` Mark Kettenis
2007-11-15  1:05             ` Ulrich Weigand
2007-11-16 23:29               ` Mark Kettenis
2007-11-17  1:05                 ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox