Add powerpc-*-netbsd support.

This commit is contained in:
tsubai 2001-08-08 21:33:45 +00:00
parent 92d578c744
commit e89a6ab2cd
8 changed files with 262 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# Host: Big-endian PowerPC running NetBSD
XDEPFILES= ser-tcp.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
NAT_CLIBS= -lkvm
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o ppcnbsd-nat.o

View File

@ -0,0 +1,3 @@
# Target: Big-endian PowerPC running NetBSD
TDEPFILES= rs6000-tdep.o solib.o
TM_FILE= tm-nbsd.h

View File

@ -0,0 +1,25 @@
/* Native-dependent definitions for PowerPC running NetBSD, for GDB.
Copyright (C) 1986, 1987, 1989, 1992, 1995, 1996
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. */
/* Need to define this before including the common nm-nbsd.h. */
#define SVR4_SHARED_LIBS 1
/* Get generic NetBSD native definitions. */
#include <nm-nbsd.h>

View File

@ -0,0 +1,29 @@
/* Macro definitions for PowerPC running NetBSD.
Copyright 1995 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
#include "powerpc/tm-ppc-eabi.h"
#undef TARGET_BYTE_ORDER_SELECTABLE_P
#define SOLIB_BKPT_NAME "_start"
#endif /* TM_NBSD_H */

View File

@ -0,0 +1,24 @@
/* Parameters for execution on a i386 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>
#define HOST_BYTE_ORDER BIG_ENDIAN

View File

@ -135,6 +135,7 @@ powerpc-*-aix*) gdb_host=aix ;;
powerpcle-*-cygwin*) gdb_host=cygwin ;;
powerpcle-*-solaris*) gdb_host=solaris ;;
powerpc-*-linux*) gdb_host=linux ;;
powerpc-*-netbsd*) gdb_host=nbsd ;;
# OBSOLETE pn-*-*) gdb_host=pn ;;

View File

@ -238,6 +238,7 @@ powerpcle-*-eabi* | powerpcle-*-sysv* | powerpcle-*-elf*)
fi ;;
powerpc-*-linux*) gdb_target=linux ;;
powerpc-*-vxworks*) gdb_target=vxworks ;;
powerpc-*-netbsd*) gdb_target=nbsd ;;
# OBSOLETE pyramid-*-*) gdb_target=pyramid ;;

172
gnu/dist/toolchain/gdb/ppcnbsd-nat.c vendored Normal file
View File

@ -0,0 +1,172 @@
/* NetBSD/powerpc native-dependent code for GDB, the GNU debugger.
Copyright 1986, 1987, 1989, 1991, 1992, 1994, 1995, 1996, 1997
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"
#include "inferior.h"
#include "target.h"
#include "gdbcore.h"
#include <sys/param.h>
#include <sys/ptrace.h>
#include <machine/frame.h>
#include <machine/reg.h>
#include <machine/pcb.h>
static void
fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
void
fetch_inferior_registers (regno)
int regno;
{
struct reg infreg;
struct fpreg inffpreg;
/* Integer registers */
ptrace(PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &infreg, 0);
memcpy(&registers[REGISTER_BYTE (GP0_REGNUM)], infreg.fixreg,
sizeof(infreg.fixreg));
*(long *) &registers[REGISTER_BYTE (PC_REGNUM)] = infreg.pc;
*(long *) &registers[REGISTER_BYTE (PS_REGNUM)] = 0; /* XXX */
*(long *) &registers[REGISTER_BYTE (CR_REGNUM)] = infreg.cr;
*(long *) &registers[REGISTER_BYTE (LR_REGNUM)] = infreg.lr;
*(long *) &registers[REGISTER_BYTE (CTR_REGNUM)] = infreg.ctr;
*(long *) &registers[REGISTER_BYTE (XER_REGNUM)] = infreg.xer;
*(long *) &registers[REGISTER_BYTE (MQ_REGNUM)] = 0;
/* Floating point registers */
ptrace(PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inffpreg, 0);
memcpy(&registers[REGISTER_BYTE (FP0_REGNUM)], inffpreg.fpreg,
sizeof(inffpreg.fpreg));
registers_fetched ();
}
void
store_inferior_registers (regno)
int regno;
{
struct reg infreg;
struct fpreg inffpreg;
/* Integer registers */
memcpy(infreg.fixreg, &registers[REGISTER_BYTE (GP0_REGNUM)],
sizeof(infreg.fixreg));
infreg.pc = *(long *) &registers[REGISTER_BYTE (PC_REGNUM)];
infreg.cr = *(long *) &registers[REGISTER_BYTE (CR_REGNUM)];
infreg.lr = *(long *) &registers[REGISTER_BYTE (LR_REGNUM)];
infreg.ctr = *(long *) &registers[REGISTER_BYTE (CTR_REGNUM)];
infreg.xer = *(long *) &registers[REGISTER_BYTE (XER_REGNUM)];
ptrace(PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &infreg, 0);
/* Floating point registers */
memset(&inffpreg, 0, sizeof(inffpreg));
memcpy(inffpreg.fpreg, &registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof(inffpreg.fpreg));
ptrace(PT_SETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inffpreg, 0);
}
static 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_coredump *core_reg;
struct trapframe *tf;
struct fpu *fs;
register int regnum;
core_reg = (struct md_coredump *)core_reg_sect;
tf = &core_reg->frame;
fs = &core_reg->fpstate;
/* Integer registers */
for (regnum = 0; regnum < 32; regnum++)
*(long *) &registers[REGISTER_BYTE (regnum)] = tf->fixreg[regnum];
/* Floating point registers */
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], fs->fpr, sizeof(fs->fpr));
/* Special registers (PC, LR) */
*(long *) &registers[REGISTER_BYTE (PC_REGNUM)] = tf->srr0;
*(long *) &registers[REGISTER_BYTE (LR_REGNUM)] = tf->lr;
registers_fetched ();
}
/* Register that we are able to handle rs6000 core file formats. */
static struct core_fns ppcnbsd_core_fns =
{
bfd_target_elf_flavour, /* core_flavour */
default_check_format, /* check_format */
default_core_sniffer, /* core_sniffer */
fetch_core_registers, /* core_read_registers */
NULL /* next */
};
void
_initialize_core_ppcnbsd ()
{
add_core_fns (&ppcnbsd_core_fns);
}
/*
* kernel_u_size() is not helpful on NetBSD because
* the "u" struct is NOT in the core dump file.
*/
#ifdef FETCH_KCORE_REGISTERS
/*
* Get registers from a kernel crash dump or live kernel.
* Called by kcore-nbsd.c:get_kcore_registers().
*/
void
fetch_kcore_registers (pcb)
struct pcb *pcb;
{
struct switchframe sf;
int regno;
/*
* get the register values out of the sys pcb and
* store them where `read_register' will find them.
*/
if (target_read_memory(pcb->pcb_sp, (char *)&sf, sizeof(sf)))
error("Cannot read switchframe.");
supply_register(1, (char *)&pcb->pcb_sp);
supply_register(2, (char *)&sf.fixreg2);
supply_register(PC_REGNUM, (char *)&sf.fill);
supply_register(LR_REGNUM, (char *)&sf.fill);
supply_register(CR_REGNUM, (char *)&sf.cr);
for (regno = 13; regno < 32; regno++)
supply_register(regno, (char *)&sf.fixreg[regno - 13]);
/* The kernel does not use the FPU, so ignore it. */
registers_fetched ();
}
#endif /* FETCH_KCORE_REGISTERS */