From: Fernando Nasser Date: Mon, 17 Dec 2001 16:23:02 +0000 (+0000) Subject: 2001-12-17 Fernando Nasser X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e7a42bc8939203328db61f21841fdc9325021078;p=binutils-gdb.git 2001-12-17 Fernando Nasser From Richard Earnshaw : * config/arm/nbsd.mh, config/arm/nbsd.mt, config/arm/tm-nbsd.h, config/arm/nm-nbsd.h, config/arm/xm-nbsd.h: New files. * armbsd-nat.c: New file. * Makefile.in: Build it. * configure.host, configure.tgt: Support NetBSD/arm. --- diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 554d0a5a81e..d0768ec55df 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1177,7 +1177,7 @@ unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET : ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ 29k-share/udi/udi2go32.c \ a29k-tdep.c a68v-nat.c alpha-nat.c alpha-tdep.c \ - arm-linux-nat.c arm-linux-tdep.c arm-tdep.c \ + arm-linux-nat.c arm-linux-tdep.c arm-tdep.c armbsd-nat.c \ coff-solib.c \ core-sol2.c core-regset.c core-aout.c corelow.c \ dcache.c delta68-nat.c dpx2-nat.c dstread.c exec.c fork-child.c \ @@ -1258,6 +1258,8 @@ arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \ arm-tdep.o: arm-tdep.c $(gdbcmd_h) $(gdbcore_h) $(inferior_h) $(defs_h) \ $(gdbcore_h) $(regcache_h) $(doublest_h) $(value_h) +armbsd-nat.o: armbsd-nat.c $(defs_h) + bcache.o: bcache.c $(bcache_h) $(defs_h) blockframe.o: blockframe.c $(defs_h) $(gdbcore_h) $(inferior_h) \ diff --git a/gdb/armbsd-nat.c b/gdb/armbsd-nat.c new file mode 100644 index 00000000000..a6b9b046137 --- /dev/null +++ b/gdb/armbsd-nat.c @@ -0,0 +1,96 @@ +/* Native-dependent code for BSD Unix running on ARM's, for GDB. + Copyright 1988, 1989, 1991, 1992, 1994, 1996, 1999 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" + +#ifdef FETCH_INFERIOR_REGISTERS +#include +#include +#include +#include +#include "inferior.h" + +void +fetch_inferior_registers (regno) + int regno; +{ + struct reg inferior_registers; + struct fpreg inferior_fpregisters; + + ptrace (PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0); + memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, + 16 * sizeof (unsigned int)); + memcpy (®isters[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr, + sizeof (unsigned int)); + ptrace (PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_fpregisters, + 0); + memcpy (®isters[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0], + 8 * sizeof (fp_reg_t)); + memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], + &inferior_fpregisters.fpr_fpsr, sizeof (unsigned int)); + registers_fetched (); +} + +void +store_inferior_registers (regno) + int regno; +{ + struct reg inferior_registers; + + memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], + 16 * sizeof (unsigned int)); + memcpy (&inferior_registers.r_cpsr, ®isters[REGISTER_BYTE (PS_REGNUM)], + sizeof (unsigned int)); + ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0); + + /* XXX Set FP regs. */ +} + +struct md_core +{ + struct reg intreg; + struct fpreg freg; +}; + +void +fetch_core_registers (core_reg_sect, core_reg_size, which, ignore) + char *core_reg_sect; + unsigned core_reg_size; + int which; + CORE_ADDR ignore; +{ + struct md_core *core_reg = (struct md_core *) core_reg_sect; + + /* integer registers */ + memcpy (®isters[REGISTER_BYTE (0)], &core_reg->intreg, + sizeof (struct reg)); + /* floating point registers */ + /* XXX */ +} + +#else +#error Not FETCH_INFERIOR_REGISTERS +#endif /* !FETCH_INFERIOR_REGISTERS */ + +int +get_longjmp_target (CORE_ADDR *addr) +{ + return 0; +} diff --git a/gdb/config/arm/nbsd.mh b/gdb/config/arm/nbsd.mh new file mode 100644 index 00000000000..9842261cc6d --- /dev/null +++ b/gdb/config/arm/nbsd.mh @@ -0,0 +1,5 @@ +# Host ARM running NetBSD +XDEPFILES= ser-tcp.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o armbsd-nat.o +XM_FILE=xm-nbsd.h +NAT_FILE=nm-nbsd.h diff --git a/gdb/config/arm/nbsd.mt b/gdb/config/arm/nbsd.mt new file mode 100644 index 00000000000..54ff5fdd6a7 --- /dev/null +++ b/gdb/config/arm/nbsd.mt @@ -0,0 +1,3 @@ +# Target: ARM running NetBSD +TDEPFILES= arm-tdep.o solib.o solib-svr4.o +TM_FILE= tm-nbsd.h diff --git a/gdb/config/arm/nm-nbsd.h b/gdb/config/arm/nm-nbsd.h new file mode 100644 index 00000000000..981d960aef8 --- /dev/null +++ b/gdb/config/arm/nm-nbsd.h @@ -0,0 +1,33 @@ +/* Native-dependent definitions for ARM running NetBSD, for GDB. + Copyright 1986, 1987, 1989, 1992, 1994, 1999 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef NM_NBSD_H +#define NM_NBSD_H + +/* Get generic NetBSD native definitions. */ +#include "nm-nbsd.h" + +#define REGISTER_U_ADDR(addr, blockend, regno) \ + (addr) = arm_register_u_addr ((blockend),(regno)); + +extern int +arm_register_u_addr PARAMS ((int, int)); + +#endif /* NM_NBSD_H */ diff --git a/gdb/config/arm/tm-nbsd.h b/gdb/config/arm/tm-nbsd.h new file mode 100644 index 00000000000..d9b84b46ab7 --- /dev/null +++ b/gdb/config/arm/tm-nbsd.h @@ -0,0 +1,60 @@ +/* Macro definitions for ARM running under NetBSD. + Copyright 1994, 1999 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef TM_NBSD_H +#define TM_NBSD_H + +/* NetBSD doesn't have single stepping support in ptrace(). */ +#define SOFTWARE_SINGLE_STEP_P 1 + +#include "arm/tm-arm.h" +#include "tm-nbsd.h" + +#define JB_ELEMENT_SIZE sizeof(long) /* jmp_buf[_JBLEN] is array of ints */ +#define JB_PC 24 /* Setjmp()'s return PC saved here */ + +/* The first page is not writeable in NetBSD. */ +#undef LOWEST_PC +#define LOWEST_PC 0x8000 + +/* Return non-zero if inside a shared-library entry stub. */ +#undef IN_SOLIB_CALL_TRAMPOLINE +#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ + STREQ ((name), "_PROCEDURE_LINKAGE_TABLE_") + +/* Figure out where the longjmp will land. Slurp the args out of the stack. + We expect the first arg to be a pointer to the jmp_buf structure from which + we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. + This routine returns true on success */ + +extern int +get_longjmp_target PARAMS ((CORE_ADDR *)); + +#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) + +/* For compatibility with previous implemenations of GDB on arm/NetBSD, + override the default little-endian breakpoint. */ +#undef ARM_LE_BREAKPOINT +#define ARM_LE_BREAKPOINT {0x11, 0x00, 0x00, 0xe6} + +/* By convention, NetBSD uses the "other" register names. */ +#define DEFAULT_REGISTER_NAMES additional_register_names + +#endif /* TM_NBSD_H */ diff --git a/gdb/config/arm/xm-nbsd.h b/gdb/config/arm/xm-nbsd.h new file mode 100644 index 00000000000..c5348d39629 --- /dev/null +++ b/gdb/config/arm/xm-nbsd.h @@ -0,0 +1,22 @@ +/* Parameters for execution on an ARM running NetBSD, for GDB. + Copyright 1994 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Get generic NetBSD host definitions. */ +#include "xm-nbsd.h" diff --git a/gdb/configure.host b/gdb/configure.host index c22ea0410f7..29aae5da96d 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -35,6 +35,7 @@ alpha*-*-linux*) gdb_host=alpha-linux ;; alpha*-*-freebsd*) gdb_host=fbsd ;; arm*-*-linux*) gdb_host=linux ;; +arm*-*-netbsd*) gdb_host=nbsd ;; arm*-*-*) gdb_host=arm ;; hppa*-*-bsd*) gdb_host=hppabsd ;; diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 815511ad44d..53e7a9b2314 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -53,6 +53,7 @@ arm*-wince-pe) gdb_target=wince ;; arm*-*-linux*) gdb_target=linux configdirs="$configdirs gdbserver" ;; +arm*-*-netbsd*) gdb_target=nbsd ;; arm*-*-* | thumb*-*-* | strongarm*-*-*) gdb_target=embed configdirs="$configdirs rdi-share"