diff --git a/gnu/usr.bin/gdb/gdb/arch/ns32k/ns32k-nat.c b/gnu/usr.bin/gdb/gdb/arch/ns32k/ns32k-nat.c index 362e608067e6..68d18e8fa12f 100644 --- a/gnu/usr.bin/gdb/gdb/arch/ns32k/ns32k-nat.c +++ b/gnu/usr.bin/gdb/gdb/arch/ns32k/ns32k-nat.c @@ -17,7 +17,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: ns32k-nat.c,v 1.1 1994/06/09 14:46:19 phil Exp $ + $Id: ns32k-nat.c,v 1.2 1995/07/28 08:00:17 phil Exp $ */ #include @@ -29,6 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include #include "defs.h" +#include "inferior.h" /* Incomplete -- PAN */ @@ -45,3 +46,190 @@ clear_regs() return; } +#ifdef notdef +struct reg { + unsigned int r_r7; + unsigned int r_r6; + unsigned int r_r5; + unsigned int r_r4; + unsigned int r_r3; + unsigned int r_r2; + unsigned int r_r1; + unsigned int r_r0; + + unsigned int r_sp; + unsigned int r_sb; + unsigned int r_fp; + unsigned int r_pc; + unsigned int r_psr; +}; +#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "sp", "fp", "pc", "ps", \ + "fsr", \ + "l0", "l1", "l2", "l3", "xx", \ + } + +struct gdb_regs { + unsigned int r0; + unsigned int r1; + unsigned int r2; + unsigned int r3; + unsigned int r4; + unsigned int r5; + unsigned int r6; + unsigned int r7; + float f0; + float f1; + float f2; + float f3; + float f4; + float f5; + float f6; + float f7; + unsigned int sp; + unsigned int fp; + unsigned int pc; + unsigned int ps; + unsigned int fsr; + double l0; + double l1; + double l2; + double l3; + double l4; + double l5; + double l6; + double l7; +}; + +#endif + +int regMap[26] = { + 7, 6, 5, 4, 3, 2, 1, 0, + -1, -1, -1, -1, -1, -1, -1, -1, + 8, 10, 11, 12, + -1, + -1, -1, -1, -1, -1 +}; + + +int inFetchReg = 0; + +void +fetch_register(int regno) +{ + union { + struct reg regs; + int r[13]; + } u; + struct fpreg fp_regs; + int *p; + char mess[128]; + + if (regMap[regno] == -1) { + /* Supply zeroes */ + memset(mess, '\0', REGISTER_RAW_SIZE (regno)); + supply_register(regno, mess); + return; + } + + if (!inFetchReg) { + inFetchReg = 1; + if (ptrace(PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &u.regs, + 0) == -1) { + sprintf(mess, "reading register %s (#%d)", + reg_names[regno], regno); + perror_with_name(mess); + } + + if (ptrace(PT_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &fp_regs, 0) == -1) { + sprintf(mess, "reading fp regs"); + perror_with_name(mess); + + } else { + fprintf(stderr, "FP Regs: fpsr %08x\n", fp_regs.r_fpsr); + p = (int *) &fp_regs.r_f0; + fprintf(stderr, " f0 %08x %08x\n", p[1], p[0]); + p += 2; + fprintf(stderr, " f1 %08x %08x\n", p[1], p[0]); + p += 2; + fprintf(stderr, " f2 %08x %08x\n", p[1], p[0]); + p += 2; + fprintf(stderr, " f3 %08x %08x\n", p[1], p[0]); + p += 2; + fprintf(stderr, " f4 %08x %08x\n", p[1], p[0]); + p += 2; + fprintf(stderr, " f5 %08x %08x\n", p[1], p[0]); + p += 2; + fprintf(stderr, " f6 %08x %08x\n", p[1], p[0]); + p += 2; + fprintf(stderr, " f7 %08x %08x\n", p[1], p[0]); + p += 2; + } + } + + supply_register(regno, &u.r[regMap[regno]]); +} + + +/* Fetch all registers, or just one, from the child process. */ + +void +fetch_inferior_registers(int regno) +{ + if (regno == -1) + for (regno = 0; regno < NUM_REGS; regno++) + fetch_register(regno); + else + fetch_register(regno); + + inFetchReg = 0; +} + +#ifdef notdef + +void +fetch_inferior_registers(regno) + int regno; +{ + struct reg inferior_registers; + struct fpreg fp_regs; + + ptrace (PT_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); + + memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, + sizeof(unsigned int) * 14); + +#ifdef notdef + ptrace (PT_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &fp_regs, 0); +fprintf(stderr, "FP Regs: fpsr %08x\n", fp_regs.r_fpsr); +fprintf(stderr, " f0 %f\n", fp_regs.r_f0); +fprintf(stderr, " f1 %f\n", fp_regs.r_f1); +fprintf(stderr, " f2 %f\n", fp_regs.r_f2); +fprintf(stderr, " f3 %f\n", fp_regs.r_f3); +fprintf(stderr, " f4 %f\n", fp_regs.r_f4); +fprintf(stderr, " f5 %f\n", fp_regs.r_f5); +fprintf(stderr, " f6 %f\n", fp_regs.r_f6); +fprintf(stderr, " f7 %f\n", fp_regs.r_f7); +#endif + + registers_fetched (); +} + +#endif + +void +store_inferior_registers (regno) + int regno; +{ + struct reg inferior_registers; + + memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], + sizeof(unsigned int) * 14); + + ptrace (PT_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); +} diff --git a/gnu/usr.bin/gdb/gdb/arch/ns32k/tm.h b/gnu/usr.bin/gdb/gdb/arch/ns32k/tm.h index c533307671f5..6d7c787f0df2 100644 --- a/gnu/usr.bin/gdb/gdb/arch/ns32k/tm.h +++ b/gnu/usr.bin/gdb/gdb/arch/ns32k/tm.h @@ -17,9 +17,10 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: tm.h,v 1.1 1994/04/28 17:11:33 phil Exp $ + $Id: tm.h,v 1.2 1995/07/28 08:03:29 phil Exp $ */ +#define FETCH_INFERIOR_REGISTERS /* Override number of expected traps from sysv. */ #define START_INFERIOR_TRAPS_EXPECTED 2 diff --git a/sys/arch/pc532/include/ptrace.h b/sys/arch/pc532/include/ptrace.h index 8da30183a22f..395182d4bc43 100644 --- a/sys/arch/pc532/include/ptrace.h +++ b/sys/arch/pc532/include/ptrace.h @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.5 1994/10/26 08:24:40 cgd Exp $ */ +/* $NetBSD: ptrace.h,v 1.6 1995/07/28 08:00:17 phil Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -36,8 +36,5 @@ #define PT_STEP (PT_FIRSTMACH + 0) #define PT_GETREGS (PT_FIRSTMACH + 1) #define PT_SETREGS (PT_FIRSTMACH + 2) -#ifdef notyet #define PT_GETFPREGS (PT_FIRSTMACH + 3) #define PT_SETFPREGS (PT_FIRSTMACH + 4) -#endif - diff --git a/sys/arch/pc532/include/reg.h b/sys/arch/pc532/include/reg.h index d891b0236378..4592dd837fdc 100644 --- a/sys/arch/pc532/include/reg.h +++ b/sys/arch/pc532/include/reg.h @@ -1,4 +1,4 @@ -/* $NetBSD: reg.h,v 1.8 1994/10/26 08:24:41 cgd Exp $ */ +/* $NetBSD: reg.h,v 1.9 1995/07/28 08:03:29 phil Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -88,6 +88,19 @@ struct reg { unsigned int r_psr; }; +struct fpreg { + double r_f0; + double r_f1; + double r_f2; + double r_f3; + double r_f4; + double r_f5; + double r_f6; + double r_f7; + + unsigned int r_fpsr; +}; + /* * Registers accessible to ptrace(2) syscall for debugger