2001-12-17 Fernando Nasser <fnasser@redhat.com>

From Richard Earnshaw <rearnsha@arm.com>:
        * 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.
This commit is contained in:
Fernando Nasser 2001-12-17 16:23:02 +00:00
parent 7c0a2a0aaa
commit e7a42bc893
9 changed files with 224 additions and 1 deletions

View File

@ -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) \

96
gdb/armbsd-nat.c Normal file
View File

@ -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 <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
#include <machine/frame.h>
#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 (&registers[REGISTER_BYTE (0)], &inferior_registers,
16 * sizeof (unsigned int));
memcpy (&registers[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
sizeof (unsigned int));
ptrace (PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_fpregisters,
0);
memcpy (&registers[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
8 * sizeof (fp_reg_t));
memcpy (&registers[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, &registers[REGISTER_BYTE (0)],
16 * sizeof (unsigned int));
memcpy (&inferior_registers.r_cpsr, &registers[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 (&registers[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;
}

5
gdb/config/arm/nbsd.mh Normal file
View File

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

3
gdb/config/arm/nbsd.mt Normal file
View File

@ -0,0 +1,3 @@
# Target: ARM running NetBSD
TDEPFILES= arm-tdep.o solib.o solib-svr4.o
TM_FILE= tm-nbsd.h

33
gdb/config/arm/nm-nbsd.h Normal file
View File

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

60
gdb/config/arm/tm-nbsd.h Normal file
View File

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

22
gdb/config/arm/xm-nbsd.h Normal file
View File

@ -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"

View File

@ -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 ;;

View File

@ -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"