[PATCH] gdb for GNU/kFreeBSD on MIPS
Robert Millan
rmh at gnu.org
Sun Jan 9 09:49:57 UTC 2011
This patch makes gdb build/work for GNU/kFreeBSD on
MIPS.
It most likely also enables FreeBSD/MIPS, although I
haven't tested that (I don't have a FreeBSD system
handy).
(ChangeLog entry in patch header)
--
Robert Millan
-------------- next part --------------
2011-01-09 Robert Millan <rmh at gnu.org>
* configure.host: Detect mips-freebsd and mips-kfreebsd-gnu, and set
`gdb_host' appropiately.
* configure.tgt: Detect mips-freebsd and mips-kfreebsd-gnu, and use
the same definitions as with mips-netbsd.
* config/mips/fbsd.mh: New file.
* config/mips/nbsd.mh (MH_CFLAGS): New variable (defines BSD_OSABI
C macro).
* mipsnbsd-tdep.c [BSD_OSABI == GDB_OSABI_FREEBSD_ELF]
(MIPSNBSD_NUM_GREGS): Define as `40'.
(MIPSNBSD_NUM_FPREGS): Define as `34'.
(NBSD_MIPS_JB_PC): Define as `12'.
* mipsnbsd-tdep.c (_initialize_mipsnbsd_tdep): Replace
`GDB_OSABI_NETBSD_ELF' with `BSD_OSABI'.
=== added file 'gdb/config/mips/fbsd.mh'
--- gdb/config/mips/fbsd.mh 1970-01-01 00:00:00 +0000
+++ gdb/config/mips/fbsd.mh 2011-01-09 09:08:54 +0000
@@ -0,0 +1,4 @@
+# Host: FreeBSD/mips
+MH_CFLAGS= -DBSD_OSABI=GDB_OSABI_FREEBSD_ELF
+NATDEPFILES= fork-child.o inf-ptrace.o \
+ fbsd-nat.o mipsnbsd-nat.o
=== modified file 'gdb/config/mips/nbsd.mh'
--- gdb/config/mips/nbsd.mh 2004-10-31 20:47:55 +0000
+++ gdb/config/mips/nbsd.mh 2011-01-09 09:08:54 +0000
@@ -1,2 +1,3 @@
# Host: NetBSD/mips
+MH_CFLAGS= -DBSD_OSABI=GDB_OSABI_NETBSD_ELF
NATDEPFILES= fork-child.o inf-ptrace.o mipsnbsd-nat.o
=== modified file 'gdb/configure.host'
--- gdb/configure.host 2010-01-19 10:22:42 +0000
+++ gdb/configure.host 2011-01-08 10:40:17 +0000
@@ -120,6 +120,8 @@ mips-sgi-irix6*) gdb_host=irix6 ;;
mips*-*-linux*) gdb_host=linux ;;
mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
gdb_host=nbsd ;;
+mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
+ gdb_host=fbsd ;;
mips64*-*-openbsd*) gdb_host=obsd64 ;;
powerpc-*-aix* | rs6000-*-*)
=== modified file 'gdb/configure.tgt'
--- gdb/configure.tgt 2010-12-29 16:15:40 +0000
+++ gdb/configure.tgt 2011-01-08 10:40:17 +0000
@@ -356,8 +356,8 @@ mips*-*-linux*)
gdb_sim=../sim/mips/libsim.a
build_gdbserver=yes
;;
-mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
- # Target: MIPS running NetBSD
+mips*-*-netbsd* | mips*-*-knetbsd*-gnu | mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
+ # Target: MIPS running *BSD
gdb_target_obs="mips-tdep.o mipsnbsd-tdep.o \
corelow.o solib.o solib-svr4.o nbsd-tdep.o"
gdb_sim=../sim/mips/libsim.a
=== modified file 'gdb/mipsnbsd-tdep.c'
--- gdb/mipsnbsd-tdep.c 2011-01-01 15:32:52 +0000
+++ gdb/mipsnbsd-tdep.c 2011-01-09 09:08:54 +0000
@@ -45,10 +45,18 @@
/* Core file support. */
/* Number of registers in `struct reg' from <machine/reg.h>. */
+#if BSD_OSABI == GDB_OSABI_NETBSD_ELF
#define MIPSNBSD_NUM_GREGS 38
+#elif BSD_OSABI == GDB_OSABI_FREEBSD_ELF
+#define MIPSNBSD_NUM_GREGS 40
+#endif
/* Number of registers in `struct fpreg' from <machine/reg.h>. */
+#if BSD_OSABI == GDB_OSABI_NETBSD_ELF
#define MIPSNBSD_NUM_FPREGS 33
+#elif BSD_OSABI == GDB_OSABI_FREEBSD_ELF
+#define MIPSNBSD_NUM_FPREGS 34
+#endif
/* Supply register REGNUM from the buffer specified by FPREGS and LEN
in the floating-point register set REGSET to register cache
@@ -251,7 +259,11 @@ static const unsigned char sigtramp_retc
at. The PC is copied into *pc. This routine returns true on
success. */
+#if BSD_OSABI == GDB_OSABI_NETBSD_ELF
#define NBSD_MIPS_JB_PC (2 * 4)
+#elif BSD_OSABI == GDB_OSABI_FREEBSD_ELF
+#define NBSD_MIPS_JB_PC 12
+#endif
#define NBSD_MIPS_JB_ELEMENT_SIZE(gdbarch) mips_isa_regsize (gdbarch)
#define NBSD_MIPS_JB_OFFSET(gdbarch) (NBSD_MIPS_JB_PC * \
NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch))
@@ -381,6 +393,6 @@ extern initialize_file_ftype _initialize
void
_initialize_mipsnbsd_tdep (void)
{
- gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_NETBSD_ELF,
+ gdbarch_register_osabi (bfd_arch_mips, 0, BSD_OSABI,
mipsnbsd_init_abi);
}
More information about the freebsd-mips
mailing list