Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] GNU/k*BSD fixes [w/ChangeLog]
@ 2004-08-07  2:20 Robert Millan
  2004-08-09  6:59 ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Millan @ 2004-08-07  2:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: glibc-bsd-hackers

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]


Hi!

Please could someone apply the attached patch?

Entry for gdb/ChangeLog follows:

2004-08-07  Robert Millan  <robertmh@gnu.org>

	* configure.host: Match kfreebsd*-gnu and knetbsd*-gnu.
	* configure.tgt: Match kfreebsd*-gnu and knetbsd*-gnu.
	* bsd-kvm.c: Check for nlist.h before including it.
	* i386bsd-nat.c: Match kernel of FreeBSD also with __FreeBSD_kernel__
	and __FreeBSD_kernel_version macros.

-- 
Robert Millan

(Debra and Ian) (Gnu's Not (UNiplexed Information and Computing System))/\
(kernel of *(Berkeley Software Distribution))

[-- Attachment #2: kbsd-gnu.diff --]
[-- Type: text/plain, Size: 8846 bytes --]

2004-08-07  Robert Millan  <robertmh@gnu.org>

	* configure.host: Match kfreebsd*-gnu and knetbsd*-gnu.
	* configure.tgt: Match kfreebsd*-gnu and knetbsd*-gnu.
	* bsd-kvm.c: Check for nlist.h before including it.
	* i386bsd-nat.c: Match kernel of FreeBSD also with __FreeBSD_kernel__
	and __FreeBSD_kernel_version macros.

diff -ur src.old/gdb/configure.host src/gdb/configure.host
--- src.old/gdb/configure.host	2004-08-06 21:14:44.000000000 +0200
+++ src/gdb/configure.host	2004-08-07 03:36:47.000000000 +0200
@@ -39,12 +39,15 @@
 alpha*-*-osf2*)		gdb_host=alpha-osf2 ;;
 alpha*-*-osf[3456789]*)	gdb_host=alpha-osf3 ;;
 alpha*-*-linux*)	gdb_host=alpha-linux ;;
-alpha*-*-freebsd*)	gdb_host=fbsd ;;
-alpha*-*-netbsd*)	gdb_host=nbsd ;;
+alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+			gdb_host=fbsd ;;
+alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
+			gdb_host=nbsd ;;
 alpha*-*-openbsd*)	gdb_host=nbsd ;;
 
 arm*-*-linux*)		gdb_host=linux ;;
-arm*-*-netbsdelf*)	gdb_host=nbsdelf ;;
+arm*-*-netbsdelf* | arm*-*-knetbsd*-gnu)
+			gdb_host=nbsdelf ;;
 arm*-*-netbsd*)		gdb_host=nbsdaout ;;
 
 hppa*-*-hiux*)		gdb_host=hppahpux ;;
@@ -61,7 +64,6 @@
 			gdb_host=fbsd ;;
 i[34567]86-*-netbsdelf* | i[34567]86-*-knetbsd*-gnu)
 			gdb_host=nbsdelf ;;
-i[34567]86-*-freebsd*)	gdb_host=fbsd ;;
 i[34567]86-*-netbsd*)	gdb_host=nbsdaout ;;
 i[34567]86-*-go32*)	gdb_host=go32 ;;
 i[34567]86-*-msdosdjgpp*) gdb_host=go32 ;;
@@ -89,7 +91,8 @@
 ia64-*-linux*)		gdb_host=linux ;;
 
 m68*-*-linux*)		gdb_host=linux ;;
-m68*-*-netbsdelf*)	gdb_host=nbsdelf ;;
+m68*-*-netbsdelf* | m68*-*-knetbsd*-gnu)
+			gdb_host=nbsdelf ;;
 m68*-*-netbsd*)		gdb_host=nbsdaout ;;
 m68*-*-openbsd*)	gdb_host=obsd ;;
 
@@ -98,7 +101,8 @@
 mips-sgi-irix5*)	gdb_host=irix5 ;;
 mips-sgi-irix6*)	gdb_host=irix6 ;;
 mips*-*-linux*)		gdb_host=linux ;;
-mips*-*-netbsd*)	gdb_host=nbsd ;;
+mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
+			gdb_host=nbsd ;;
 
 ns32k-*-netbsd*)	gdb_host=nbsdaout ;;
 
@@ -107,7 +111,8 @@
 powerpc-*-aix4.3.[0-1]*)	gdb_host=aix ;;
 powerpc-*-aix*)		gdb_host=aix432 ;;
 powerpc-*-linux*)	gdb_host=linux ;;
-powerpc-*-netbsd*)	gdb_host=nbsd ;;
+powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
+			gdb_host=nbsd ;;
 powerpc-*-openbsd*)	gdb_host=obsd ;;
 
 powerpc64-*-linux*)     gdb_host=ppc64-linux ;;
@@ -118,15 +123,19 @@
 
 s390*-*-*)		gdb_host=s390 ;;
 
-sh*-*-netbsdelf*)	gdb_host=nbsd ;;
+sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
+			gdb_host=nbsd ;;
 
-sparc64-*-freebsd*)	gdb_host=fbsd ;;
+sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
+			gdb_host=fbsd ;;
 sparc-*-linux*)		gdb_host=linux ;;
 sparc64-*-linux*)	gdb_host=linux64 ;;
-sparc-*-netbsdelf*)	gdb_host=nbsdelf ;;
+sparc-*-netbsdelf* | sparc-*-knetbsd*-gnu)
+			gdb_host=nbsdelf ;;
 sparc-*-netbsdaout*)	gdb_host=nbsdaout ;;
 sparc-*-netbsd*)	gdb_host=nbsdaout ;;
-sparc64-*-netbsd*)	gdb_host=nbsd64 ;;
+sparc64-*-netbsd* | sparc64-*-knetbsd*-gnu)
+			gdb_host=nbsd64 ;;
 sparc-*-openbsd*)	gdb_host=nbsdelf ;;
 sparc64-*-openbsd*)	gdb_host=nbsd64 ;;
 sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
@@ -134,14 +143,17 @@
 			;;
 
 vax-*-bsd*)		gdb_host=vax ;;
-vax-*-netbsdelf*)	gdb_host=nbsdelf ;;
+vax-*-netbsdelf* | vax-*-knetbsd*-gnu)
+			gdb_host=nbsdelf ;;
 vax-*-netbsd*)		gdb_host=nbsdaout ;;
 vax-*-openbsd*)		gdb_host=obsd ;;
 vax-*-ultrix*)		gdb_host=vax ;;
 
 x86_64-*-linux*)	gdb_host=linux64 ;;
-x86_64-*-freebsd*)	gdb_host=fbsd64 ;;
-x86_64-*-netbsd*)	gdb_host=nbsd64 ;;
+x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
+			gdb_host=fbsd64 ;;
+x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
+			gdb_host=nbsd64 ;;
 x86_64-*-openbsd*)	gdb_host=obsd64 ;;
 
 m32r*-*-linux*)          gdb_host=linux ;;
diff -ur src.old/gdb/configure.tgt src/gdb/configure.tgt
--- src.old/gdb/configure.tgt	2004-06-26 12:06:34.000000000 +0200
+++ src/gdb/configure.tgt	2004-08-07 04:00:53.000000000 +0200
@@ -38,12 +38,15 @@
 
 case "${target}" in
 
-x86_64-*-freebsd*)	gdb_target=fbsd64 ;;
-*-*-freebsd*)		gdb_target=fbsd	;;
+x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
+			gdb_target=fbsd64 ;;
+*-*-freebsd* | *-*-kfreebsd*-gnu)
+			gdb_target=fbsd	;;
 
 alpha*-*-osf*)		gdb_target=alpha-osf1 ;;
 alpha*-*-linux*)	gdb_target=alpha-linux ;;
-alpha*-*-netbsd*)	gdb_target=nbsd ;;
+alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 alpha*-*-openbsd*)	gdb_target=nbsd ;;
 alpha*-*-*)		gdb_target=alpha ;;
 
@@ -51,7 +54,8 @@
 arm*-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;
-arm*-*-netbsd*)		gdb_target=nbsd ;;
+arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 arm-*-nto*)		gdb_target=nto ;;
 arm*-*-* | thumb*-*-* | strongarm*-*-*)
 			gdb_target=embed
@@ -115,7 +119,8 @@
 m68*-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;
-m68*-*-netbsd*)		gdb_target=nbsd ;;
+m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 m68*-*-openbsd*)	gdb_target=obsd ;;
 m68*-*-os68k*)		gdb_target=os68k ;;
 m68*-*-uclinux*)	gdb_target=monitor ;;
@@ -131,7 +136,8 @@
 mips*-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;
-mips*-*-netbsd*)	gdb_target=nbsd ;;
+mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 mips*-*-vxworks*)       gdb_target=vxmips ;;
 mips*-*-*)		gdb_target=embed ;;
 
@@ -139,7 +145,8 @@
 
 ns32k-*-netbsd*)	gdb_target=nbsdaout ;;
 
-powerpc-*-netbsd*)	gdb_target=nbsd ;;
+powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 powerpc-*-openbsd*)	gdb_target=obsd ;;
 powerpc-*-aix*)		gdb_target=aix ;;
 powerpc-*-linux*)	gdb_target=linux
@@ -168,14 +175,17 @@
 sh-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;
-sh*-*-netbsdelf*)	gdb_target=nbsd ;;
+sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 sh-*-nto*)		gdb_target=nto ;;
 sh*)			gdb_target=embed ;;
 
 sparc-*-linux*)		gdb_target=linux ;;
 sparc64-*-linux*)	gdb_target=linux64 ;;
-sparc-*-netbsd*)	gdb_target=nbsd ;;
-sparc64-*-netbsd*)	gdb_target=nbsd64 ;;
+sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
+sparc64-*-netbsd* | sparc64-*-knetbsd*-gnu)
+			gdb_target=nbsd64 ;;
 sparc-*-openbsd*)	gdb_target=obsd ;;
 sparc64-*-openbsd*)	gdb_target=obsd64
 			gdb_osabi=GDB_OSABI_OPENBSD_ELF
@@ -192,7 +202,8 @@
 
 xstormy16-*-*)          gdb_target=xstormy16 ;;
 
-vax-*-netbsd*)		gdb_target=nbsd ;;
+vax-*-netbsd* | vax-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 vax-*-openbsd*)		gdb_target=nbsd ;;
 vax-*-*)		gdb_target=vax ;;
 
@@ -207,7 +218,8 @@
 x86_64-*-linux*)	gdb_target=linux64
 			build_gdbserver=yes
 			;;
-x86_64-*-netbsd*)	gdb_target=nbsd64 ;;
+x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
+			gdb_target=nbsd64 ;;
 x86_64-*-openbsd*)	gdb_target=obsd64 ;;
 
 esac
@@ -216,7 +228,8 @@
 
 case "${target}" in
 *-*-linux*)	gdb_osabi=GDB_OSABI_LINUX ;;
-*-*-gnu*)	gdb_osabi=GDB_OSABI_HURD ;;
 *-*-nto*)	gdb_osabi=GDB_OSABI_QNXNTO ;;
 *-*-solaris*)	gdb_osabi=GDB_OSABI_SOLARIS ;;
+*-*-*-gnu*)	;; # prevent non-GNU kernels to match the Hurd rule below
+*-*-gnu*)	gdb_osabi=GDB_OSABI_HURD ;;
 esac
diff -ur src.old/gdb/bsd-kvm.c src/gdb/bsd-kvm.c
--- src.old/gdb/bsd-kvm.c	2004-07-03 15:17:33.000000000 +0200
+++ src/gdb/bsd-kvm.c	2004-08-07 03:09:50.000000000 +0200
@@ -19,6 +19,10 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "defs.h"
 #include "cli/cli-cmds.h"
 #include "command.h"
@@ -30,7 +34,9 @@
 #include "gdb_assert.h"
 #include <fcntl.h>
 #include <kvm.h>
+#ifdef HAVE_NLIST_H
 #include <nlist.h>
+#endif
 #include "readline/readline.h"
 #include <sys/param.h>
 #include <sys/proc.h>
diff -ur src.old/gdb/i386bsd-nat.c src/gdb/i386bsd-nat.c
--- src.old/gdb/i386bsd-nat.c	2004-05-31 13:20:41.000000000 +0200
+++ src/gdb/i386bsd-nat.c	2004-08-07 03:09:50.000000000 +0200
@@ -35,6 +35,16 @@
 #include "i387-tdep.h"
 \f
 
+#if defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
+# define __FreeBSD_kernel__ __FreeBSD__
+#endif
+#ifdef __FreeBSD_kernel__
+# include <osreldate.h>
+# ifndef __FreeBSD_kernel_version
+#  define __FreeBSD_kernel_version __FreeBSD_version
+# endif
+#endif
+
 /* In older BSD versions we cannot get at some of the segment
    registers.  FreeBSD for example didn't support the %fs and %gs
    registers until the 3.0 release.  We have autoconf checks for their
@@ -349,9 +359,9 @@
      system header files and sysctl(3) to get at the relevant
      information.  */
 
-#if defined (__FreeBSD_version) && __FreeBSD_version >= 400011
+#if defined (__FreeBSD_kernel_version) && __FreeBSD_kernel_version >= 400011
 #define SC_REG_OFFSET i386fbsd4_sc_reg_offset
-#elif defined (__FreeBSD_version) && __FreeBSD_version >= 300005
+#elif defined (__FreeBSD_kernel_version) && __FreeBSD_kernel_version >= 300005
 #define SC_REG_OFFSET i386fbsd_sc_reg_offset
 #elif defined (NetBSD) || defined (__NetBSD_Version__)
 #define SC_REG_OFFSET i386nbsd_sc_reg_offset

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

* Re: [PATCH] GNU/k*BSD fixes [w/ChangeLog]
  2004-08-07  2:20 [PATCH] GNU/k*BSD fixes [w/ChangeLog] Robert Millan
@ 2004-08-09  6:59 ` Mark Kettenis
  2004-08-09 16:32   ` Robert Millan
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2004-08-09  6:59 UTC (permalink / raw)
  To: rmh; +Cc: gdb-patches, glibc-bsd-hackers

   Date: Sat, 7 Aug 2004 04:20:15 +0200
   From: Robert Millan <rmh@debian.org>

   Hi!

   Please could someone apply the attached patch?

   Entry for gdb/ChangeLog follows:

   2004-08-07  Robert Millan  <robertmh@gnu.org>

	   * configure.host: Match kfreebsd*-gnu and knetbsd*-gnu.
	   * configure.tgt: Match kfreebsd*-gnu and knetbsd*-gnu.
	   * bsd-kvm.c: Check for nlist.h before including it.
	   * i386bsd-nat.c: Match kernel of FreeBSD also with
	   __FreeBSD_kernel__ and __FreeBSD_kernel_version macros.

Yuck, the #ifdef mess in i386bsd-nat.c gets ugly.  I think it should
be simplified.  You're probably changing it to avoid the warning about
the offsets in `struct sigcontext'.  If I just drop the support for
ancient BSD (which isn't used anyway) we can avoid that.  You won't
get the extra check on GNU/kFreeBSD then, but as long as enough people
use GDB on normal FreeBSD/i386, this doesn't really matter.

Considering the changes to bsd-kvm.c.  We shouldn't include config.h
directly.  In GDB "defs.h" does that for us.  I assume that GNU/k*BSD
still has libkvm.  Why doesn't it have <nlist.h>?  If not, then where
does it get its `struct nlist' from?

Mark


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

* Re: [PATCH] GNU/k*BSD fixes [w/ChangeLog]
  2004-08-09  6:59 ` Mark Kettenis
@ 2004-08-09 16:32   ` Robert Millan
  2004-08-09 17:48     ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Millan @ 2004-08-09 16:32 UTC (permalink / raw)
  To: Mark Kettenis, Nathanael Nerode; +Cc: gdb-patches, glibc-bsd-hackers


[ Nathanael, your email server at rr.com is rejecting my mail due to
blacklisting.  You will probably only read this message through gdb-patches.
I have tried neroden-guest@alioth.debian.org too, with no luck. Please tell
me an address where I can reach you. ]

On Sun, Aug 08, 2004 at 11:59:32PM -0400, Nathanael Nerode wrote:
> +#if defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
> +# define __FreeBSD_kernel__ __FreeBSD__
> +#endif
> +#ifdef __FreeBSD_kernel__
> +# include <osreldate.h>
> +# ifndef __FreeBSD_kernel_version
> +#  define __FreeBSD_kernel_version __FreeBSD_version
> +# endif
> +#endif
> 
> ...and I wondered if it is absolutely guaranteed that <osreldate.h> will
> exist on all FreeBSD and FreeBSD-kernel systems of any possible vintage
> supported by GDB.  Cause otherwise this could break the build on other
> systems.

Asides GNU/kFreeBSD I'm not aware of other non-FreeBSD systems using kernel
of FreeBSD.  Wrt different versions of FreeBSD, I can't be completely sure some
arcane version of FreeBSD didn't have osreldate.h.

I propose the following alternative, which also looks cleaner:

#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h> /* __FreeBSD_{kernel_,}version */
#endif
#if defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
# define __FreeBSD_kernel__ __FreeBSD__
# define __FreeBSD_kernel_version __FreeBSD_version
#endif

(note: osreldate.h and sys/param.h are equivalent for this purpose)


On Mon, Aug 09, 2004 at 08:59:20AM +0200, Mark Kettenis wrote:
> 
> Yuck, the #ifdef mess in i386bsd-nat.c gets ugly.  I think it should
> be simplified.

Does the proposed alternative above address this concern?

> You're probably changing it to avoid the warning about
> the offsets in `struct sigcontext'.  If I just drop the support for
> ancient BSD (which isn't used anyway) we can avoid that.  You won't
> get the extra check on GNU/kFreeBSD then, but as long as enough people
> use GDB on normal FreeBSD/i386, this doesn't really matter.

The oldest version of kFreeBSD we ever supported is 4.6, so compatibility
with 3.x is not an issue for us.  If you want to drop support for 3.x, that
is fine with me.

> Considering the changes to bsd-kvm.c.  We shouldn't include config.h
> directly.  In GDB "defs.h" does that for us.

Ok.

> I assume that GNU/k*BSD
> still has libkvm.  Why doesn't it have <nlist.h>?  If not, then where
> does it get its `struct nlist' from?

We have libkvm, but not nlist() which is not part of Glibc.  I'm considering
adding nlist() and other functions in a compatibility library (e.g. libbsd),
though.

But I was surprised that disabling the '#include <nlist.h>' didn't cause the
build process to fail on missing declarations.  Does bsd-kvm.c really work
without nlist, or am I missing something?

-- 
Robert Millan

(Debra and Ian) (Gnu's Not (UNiplexed Information and Computing System))/\
(kernel of *(Berkeley Software Distribution))


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

* Re: [PATCH] GNU/k*BSD fixes [w/ChangeLog]
  2004-08-09 16:32   ` Robert Millan
@ 2004-08-09 17:48     ` Mark Kettenis
  2004-08-09 19:19       ` Robert Millan
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2004-08-09 17:48 UTC (permalink / raw)
  To: rmh; +Cc: neroden, gdb-patches, glibc-bsd-hackers

   Date: Mon, 9 Aug 2004 18:28:31 +0200
   From: Robert Millan <rmh@debian.org>

   Asides GNU/kFreeBSD I'm not aware of other non-FreeBSD systems
   using kernel of FreeBSD.  Wrt different versions of FreeBSD, I
   can't be completely sure some arcane version of FreeBSD didn't have
   osreldate.h.

   I propose the following alternative, which also looks cleaner:

   #ifdef HAVE_SYS_PARAM_H
   #include <sys/param.h> /* __FreeBSD_{kernel_,}version */
   #endif
   #if defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
   # define __FreeBSD_kernel__ __FreeBSD__
   # define __FreeBSD_kernel_version __FreeBSD_version
   #endif

   (note: osreldate.h and sys/param.h are equivalent for this purpose)

Indeed <sys/param.h> defenitely exists on all FreeBSD systems, and is
the official way to get the defined we're talking about here.

   On Mon, Aug 09, 2004 at 08:59:20AM +0200, Mark Kettenis wrote:
   > 
   > Yuck, the #ifdef mess in i386bsd-nat.c gets ugly.  I think it should
   > be simplified.

   Does the proposed alternative above address this concern?

Not really.  I'm sort of bending the rules in i386bsd-nat.c by
checking the version numbers.  By adding more to it, I run the risk
that people start noticing it ;-).  Anyway, this code is not really
adding any functionality.  It's just a bunch of consistency checks,
that you can perfectly well do without.

   > You're probably changing it to avoid the warning about
   > the offsets in `struct sigcontext'.  If I just drop the support for
   > ancient BSD (which isn't used anyway) we can avoid that.  You won't
   > get the extra check on GNU/kFreeBSD then, but as long as enough people
   > use GDB on normal FreeBSD/i386, this doesn't really matter.

   The oldest version of kFreeBSD we ever supported is 4.6, so compatibility
   with 3.x is not an issue for us.  If you want to drop support for 3.x, that
   is fine with me.

I'm talking about dropping support for pre-FreeBSD-BSD here, which
actually isn't supported.  I'll remove that stuff and you can forget
about the #ifdefs.

   > I assume that GNU/k*BSD
   > still has libkvm.  Why doesn't it have <nlist.h>?  If not, then where
   > does it get its `struct nlist' from?

   We have libkvm, but not nlist() which is not part of Glibc.  I'm considering
   adding nlist() and other functions in a compatibility library (e.g. libbsd),
   though.

IIRC the Hurd once had such a compatibility library.  Anyway ...

   But I was surprised that disabling the '#include <nlist.h>' didn't cause the
   build process to fail on missing declarations.  Does bsd-kvm.c really work
   without nlist, or am I missing something?

It only needs the definition of `struct nlist'.  If something else
provides that (presumably your <kvm.h> has been hacked to do that)
everything is fine.  I'll add the #ifdef HAVE_NLIST_H.  It can't hurt.

Mark


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

* Re: [PATCH] GNU/k*BSD fixes [w/ChangeLog]
  2004-08-09 17:48     ` Mark Kettenis
@ 2004-08-09 19:19       ` Robert Millan
  2004-08-09 21:25         ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Millan @ 2004-08-09 19:19 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: neroden, gdb-patches, glibc-bsd-hackers

On Mon, Aug 09, 2004 at 07:48:33PM +0200, Mark Kettenis wrote:
> 
>    (note: osreldate.h and sys/param.h are equivalent for this purpose)
> 
> Indeed <sys/param.h> defenitely exists on all FreeBSD systems, and is
> the official way to get the defined we're talking about here.

Ok.  I'll take note on this.

> Not really.  I'm sort of bending the rules in i386bsd-nat.c by
> checking the version numbers.  By adding more to it, I run the risk
> that people start noticing it ;-).  Anyway, this code is not really
> adding any functionality.  It's just a bunch of consistency checks,
> that you can perfectly well do without.
> 
> [...]
> 
> I'm talking about dropping support for pre-FreeBSD-BSD here, which
> actually isn't supported.  I'll remove that stuff and you can forget
> about the #ifdefs.

But the macro checks indicated the check is for FreeBSD 3.x?  Well, I'm
probably missing something here..

>    We have libkvm, but not nlist() which is not part of Glibc.  I'm considering
>    adding nlist() and other functions in a compatibility library (e.g. libbsd),
>    though.
> 
> IIRC the Hurd once had such a compatibility library.  Anyway ...

It was part of Glibc.  Then it was renamed to libutil and still exists, but
with a slightly different purpose.

>    But I was surprised that disabling the '#include <nlist.h>' didn't cause the
>    build process to fail on missing declarations.  Does bsd-kvm.c really work
>    without nlist, or am I missing something?
> 
> It only needs the definition of `struct nlist'.  If something else
> provides that (presumably your <kvm.h> has been hacked to do that)

Heh.  Actualy I hacked kvm.h myself to do precisely this (through inclussion
of some kernel headers).  I just didn't remember. =)

> everything is fine.  I'll add the #ifdef HAVE_NLIST_H.  It can't hurt.

Ok.  Please don't forget about the hunks for gdb/configure.{host,tgt}.

-- 
Robert Millan

(Debra and Ian) (Gnu's Not (UNiplexed Information and Computing System))/\
(kernel of *(Berkeley Software Distribution))


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

* Re: [PATCH] GNU/k*BSD fixes [w/ChangeLog]
  2004-08-09 19:19       ` Robert Millan
@ 2004-08-09 21:25         ` Mark Kettenis
  2004-08-09 22:34           ` Robert Millan
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2004-08-09 21:25 UTC (permalink / raw)
  To: rmh; +Cc: neroden, gdb-patches, glibc-bsd-hackers

   Date: Mon, 9 Aug 2004 21:19:14 +0200
   From: Robert Millan <rmh@debian.org>

   Ok.  Please don't forget about the hunks for gdb/configure.{host,tgt}.

Hmm, the patch doesn't apply cleanly.  Can you regenerate configure
bits for me?


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

* Re: [PATCH] GNU/k*BSD fixes [w/ChangeLog]
  2004-08-09 21:25         ` Mark Kettenis
@ 2004-08-09 22:34           ` Robert Millan
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Millan @ 2004-08-09 22:34 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches, glibc-bsd-hackers

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

On Mon, Aug 09, 2004 at 11:25:30PM +0200, Mark Kettenis wrote:
>    Date: Mon, 9 Aug 2004 21:19:14 +0200
>    From: Robert Millan <rmh@debian.org>
> 
>    Ok.  Please don't forget about the hunks for gdb/configure.{host,tgt}.
> 
> Hmm, the patch doesn't apply cleanly.  Can you regenerate configure
> bits for me?

Attached.

-- 
Robert Millan

(Debra and Ian) (Gnu's Not (UNiplexed Information and Computing System))/\
(kernel of *(Berkeley Software Distribution))

[-- Attachment #2: kbsd-gnu.diff --]
[-- Type: text/plain, Size: 6816 bytes --]

2004-08-09  Robert Millan  <robertmh@gnu.org>

	* configure.host: Match kfreebsd*-gnu and knetbsd*-gnu.
	* configure.tgt: Match kfreebsd*-gnu and knetbsd*-gnu.

diff -ur src.old/gdb/configure.host src/gdb/configure.host
--- src.old/gdb/configure.host	2004-08-06 21:14:44.000000000 +0200
+++ src/gdb/configure.host	2004-08-10 00:24:22.000000000 +0200
@@ -39,12 +39,15 @@
 alpha*-*-osf2*)		gdb_host=alpha-osf2 ;;
 alpha*-*-osf[3456789]*)	gdb_host=alpha-osf3 ;;
 alpha*-*-linux*)	gdb_host=alpha-linux ;;
-alpha*-*-freebsd*)	gdb_host=fbsd ;;
-alpha*-*-netbsd*)	gdb_host=nbsd ;;
+alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+			gdb_host=fbsd ;;
+alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
+			gdb_host=nbsd ;;
 alpha*-*-openbsd*)	gdb_host=nbsd ;;
 
 arm*-*-linux*)		gdb_host=linux ;;
-arm*-*-netbsdelf*)	gdb_host=nbsdelf ;;
+arm*-*-netbsdelf* | arm*-*-knetbsd*-gnu)
+			gdb_host=nbsdelf ;;
 arm*-*-netbsd*)		gdb_host=nbsdaout ;;
 
 hppa*-*-hiux*)		gdb_host=hppahpux ;;
@@ -61,7 +64,6 @@
 			gdb_host=fbsd ;;
 i[34567]86-*-netbsdelf* | i[34567]86-*-knetbsd*-gnu)
 			gdb_host=nbsdelf ;;
-i[34567]86-*-freebsd*)	gdb_host=fbsd ;;
 i[34567]86-*-netbsd*)	gdb_host=nbsdaout ;;
 i[34567]86-*-go32*)	gdb_host=go32 ;;
 i[34567]86-*-msdosdjgpp*) gdb_host=go32 ;;
@@ -89,7 +91,8 @@
 ia64-*-linux*)		gdb_host=linux ;;
 
 m68*-*-linux*)		gdb_host=linux ;;
-m68*-*-netbsdelf*)	gdb_host=nbsdelf ;;
+m68*-*-netbsdelf* | m68*-*-knetbsd*-gnu)
+			gdb_host=nbsdelf ;;
 m68*-*-netbsd*)		gdb_host=nbsdaout ;;
 m68*-*-openbsd*)	gdb_host=obsd ;;
 
@@ -98,7 +101,8 @@
 mips-sgi-irix5*)	gdb_host=irix5 ;;
 mips-sgi-irix6*)	gdb_host=irix6 ;;
 mips*-*-linux*)		gdb_host=linux ;;
-mips*-*-netbsd*)	gdb_host=nbsd ;;
+mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
+			gdb_host=nbsd ;;
 
 ns32k-*-netbsd*)	gdb_host=nbsdaout ;;
 
@@ -107,7 +111,8 @@
 powerpc-*-aix4.3.[0-1]*)	gdb_host=aix ;;
 powerpc-*-aix*)		gdb_host=aix432 ;;
 powerpc-*-linux*)	gdb_host=linux ;;
-powerpc-*-netbsd*)	gdb_host=nbsd ;;
+powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
+			gdb_host=nbsd ;;
 powerpc-*-openbsd*)	gdb_host=obsd ;;
 
 powerpc64-*-linux*)     gdb_host=ppc64-linux ;;
@@ -118,15 +123,19 @@
 
 s390*-*-*)		gdb_host=s390 ;;
 
-sh*-*-netbsdelf*)	gdb_host=nbsd ;;
+sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
+			gdb_host=nbsd ;;
 
-sparc64-*-freebsd*)	gdb_host=fbsd ;;
+sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
+			gdb_host=fbsd ;;
 sparc-*-linux*)		gdb_host=linux ;;
 sparc64-*-linux*)	gdb_host=linux64 ;;
-sparc-*-netbsdelf*)	gdb_host=nbsdelf ;;
+sparc-*-netbsdelf* | sparc-*-knetbsd*-gnu)
+			gdb_host=nbsdelf ;;
 sparc-*-netbsdaout*)	gdb_host=nbsdaout ;;
 sparc-*-netbsd*)	gdb_host=nbsdaout ;;
-sparc64-*-netbsd*)	gdb_host=nbsd64 ;;
+sparc64-*-netbsd* | sparc64-*-knetbsd*-gnu)
+			gdb_host=nbsd64 ;;
 sparc-*-openbsd*)	gdb_host=nbsdelf ;;
 sparc64-*-openbsd*)	gdb_host=nbsd64 ;;
 sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
@@ -134,14 +143,17 @@
 			;;
 
 vax-*-bsd*)		gdb_host=vax ;;
-vax-*-netbsdelf*)	gdb_host=nbsdelf ;;
+vax-*-netbsdelf* | vax-*-knetbsd*-gnu)
+			gdb_host=nbsdelf ;;
 vax-*-netbsd*)		gdb_host=nbsdaout ;;
 vax-*-openbsd*)		gdb_host=obsd ;;
 vax-*-ultrix*)		gdb_host=vax ;;
 
 x86_64-*-linux*)	gdb_host=linux64 ;;
-x86_64-*-freebsd*)	gdb_host=fbsd64 ;;
-x86_64-*-netbsd*)	gdb_host=nbsd64 ;;
+x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
+			gdb_host=fbsd64 ;;
+x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
+			gdb_host=nbsd64 ;;
 x86_64-*-openbsd*)	gdb_host=obsd64 ;;
 
 m32r*-*-linux*)          gdb_host=linux ;;
diff -ur src.old/gdb/configure.tgt src/gdb/configure.tgt
--- src.old/gdb/configure.tgt	2004-08-09 23:20:28.000000000 +0200
+++ src/gdb/configure.tgt	2004-08-10 00:24:59.000000000 +0200
@@ -38,12 +38,15 @@
 
 case "${target}" in
 
-x86_64-*-freebsd*)	gdb_target=fbsd64 ;;
-*-*-freebsd*)		gdb_target=fbsd	;;
+x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
+			gdb_target=fbsd64 ;;
+*-*-freebsd* | *-*-kfreebsd*-gnu)
+			gdb_target=fbsd	;;
 
 alpha*-*-osf*)		gdb_target=alpha-osf1 ;;
 alpha*-*-linux*)	gdb_target=alpha-linux ;;
-alpha*-*-netbsd*)	gdb_target=nbsd ;;
+alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 alpha*-*-openbsd*)	gdb_target=nbsd ;;
 alpha*-*-*)		gdb_target=alpha ;;
 
@@ -51,7 +54,8 @@
 arm*-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;
-arm*-*-netbsd*)		gdb_target=nbsd ;;
+arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 arm-*-nto*)		gdb_target=nto ;;
 arm*-*-* | thumb*-*-* | strongarm*-*-*)
 			gdb_target=embed
@@ -115,7 +119,8 @@
 m68*-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;
-m68*-*-netbsd*)		gdb_target=nbsd ;;
+m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 m68*-*-openbsd*)	gdb_target=obsd ;;
 m68*-*-os68k*)		gdb_target=os68k ;;
 m68*-*-uclinux*)	gdb_target=monitor ;;
@@ -131,7 +136,8 @@
 mips*-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;
-mips*-*-netbsd*)	gdb_target=nbsd ;;
+mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 mips*-*-vxworks*)       gdb_target=vxmips ;;
 mips*-*-*)		gdb_target=embed ;;
 
@@ -139,7 +145,8 @@
 
 ns32k-*-netbsd*)	gdb_target=nbsdaout ;;
 
-powerpc-*-netbsd*)	gdb_target=nbsd ;;
+powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 powerpc-*-openbsd*)	gdb_target=obsd ;;
 powerpc-*-aix*)		gdb_target=aix ;;
 powerpc-*-linux*)	gdb_target=linux
@@ -168,14 +175,17 @@
 sh-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;
-sh*-*-netbsdelf*)	gdb_target=nbsd ;;
+sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 sh-*-nto*)		gdb_target=nto ;;
 sh*)			gdb_target=embed ;;
 
 sparc-*-linux*)		gdb_target=linux ;;
 sparc64-*-linux*)	gdb_target=linux64 ;;
-sparc-*-netbsd*)	gdb_target=nbsd ;;
-sparc64-*-netbsd*)	gdb_target=nbsd64 ;;
+sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
+sparc64-*-netbsd* | sparc64-*-knetbsd*-gnu)
+			gdb_target=nbsd64 ;;
 sparc-*-openbsd*)	gdb_target=obsd ;;
 sparc64-*-openbsd*)	gdb_target=obsd64
 			gdb_osabi=GDB_OSABI_OPENBSD_ELF
@@ -192,7 +202,8 @@
 
 xstormy16-*-*)          gdb_target=xstormy16 ;;
 
-vax-*-netbsd*)		gdb_target=nbsd ;;
+vax-*-netbsd* | vax-*-knetbsd*-gnu)
+			gdb_target=nbsd ;;
 vax-*-openbsd*)		gdb_target=nbsd ;;
 vax-*-*)		gdb_target=vax ;;
 
@@ -207,7 +218,8 @@
 x86_64-*-linux*)	gdb_target=linux64
 			build_gdbserver=yes
 			;;
-x86_64-*-netbsd*)	gdb_target=nbsd64 ;;
+x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
+			gdb_target=nbsd64 ;;
 x86_64-*-openbsd*)	gdb_target=obsd64
 			gdb_osabi=GDB_OSABI_OPENBSD_ELF
 			;;
@@ -218,7 +230,8 @@
 
 case "${target}" in
 *-*-linux*)	gdb_osabi=GDB_OSABI_LINUX ;;
-*-*-gnu*)	gdb_osabi=GDB_OSABI_HURD ;;
 *-*-nto*)	gdb_osabi=GDB_OSABI_QNXNTO ;;
 *-*-solaris*)	gdb_osabi=GDB_OSABI_SOLARIS ;;
+*-*-*-gnu*)	;; # prevent non-GNU kernels to match the Hurd rule below
+*-*-gnu*)	gdb_osabi=GDB_OSABI_HURD ;;
 esac

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

* Re: [PATCH] GNU/k*BSD fixes [w/ChangeLog]
@ 2004-08-09  3:59 Nathanael Nerode
  0 siblings, 0 replies; 8+ messages in thread
From: Nathanael Nerode @ 2004-08-09  3:59 UTC (permalink / raw)
  To: robertmh; +Cc: gdb-patches

So I was going to commit this patch 
(http://sources.redhat.com/ml/gdb-patches/2004-08/msg00192.html)
as obviously correct, but then I looked at this bit:

diff -ur src.old/gdb/i386bsd-nat.c src/gdb/i386bsd-nat.c
--- src.old/gdb/i386bsd-nat.c	2004-05-31 13:20:41.000000000 +0200
+++ src/gdb/i386bsd-nat.c	2004-08-07 03:09:50.000000000 +0200
@@ -35,6 +35,16 @@
 #include "i387-tdep.h"
 
 
+#if defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
+# define __FreeBSD_kernel__ __FreeBSD__
+#endif
+#ifdef __FreeBSD_kernel__
+# include <osreldate.h>
+# ifndef __FreeBSD_kernel_version
+#  define __FreeBSD_kernel_version __FreeBSD_version
+# endif
+#endif

...and I wondered if it is absolutely guaranteed that <osreldate.h> will
exist on all FreeBSD and FreeBSD-kernel systems of any possible vintage
supported by GDB.  Cause otherwise this could break the build on other
systems.

-- 
There are none so blind as those who will not see.


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

end of thread, other threads:[~2004-08-09 22:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-07  2:20 [PATCH] GNU/k*BSD fixes [w/ChangeLog] Robert Millan
2004-08-09  6:59 ` Mark Kettenis
2004-08-09 16:32   ` Robert Millan
2004-08-09 17:48     ` Mark Kettenis
2004-08-09 19:19       ` Robert Millan
2004-08-09 21:25         ` Mark Kettenis
2004-08-09 22:34           ` Robert Millan
2004-08-09  3:59 Nathanael Nerode

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