2004-08-07 Robert Millan * 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 +#endif + #include "defs.h" #include "cli/cli-cmds.h" #include "command.h" @@ -30,7 +34,9 @@ #include "gdb_assert.h" #include #include +#ifdef HAVE_NLIST_H #include +#endif #include "readline/readline.h" #include #include 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 +# 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