From 22c720812e398d45e1529caf3e7486c933c5084e Mon Sep 17 00:00:00 2001 From: "J.T. Conklin" Date: Tue, 21 Nov 2000 00:25:58 +0000 Subject: [PATCH] * gdbserver/low-nbsd.c (fetch_inferior_registers, store_inferior_registers): Support older NetBSD/powerpc systems from before fp reg support was added. Adapt to register number changes caused when powerpc target was multi-arched. --- gdb/ChangeLog | 7 +++++++ gdb/gdbserver/low-nbsd.c | 38 +++++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 45cefb2762e..3b8fceb6f60 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2000-11-20 J.T. Conklin + + * gdbserver/low-nbsd.c (fetch_inferior_registers, + store_inferior_registers): Support older NetBSD/powerpc systems + from before fp reg support was added. Adapt to register number + changes caused when powerpc target was multi-arched. + 2000-11-20 H.J. Lu * ia64-tdep.c (gdbarch_tdep): Change reference from diff --git a/gdb/gdbserver/low-nbsd.c b/gdb/gdbserver/low-nbsd.c index 915dd68845d..b5199dca775 100644 --- a/gdb/gdbserver/low-nbsd.c +++ b/gdb/gdbserver/low-nbsd.c @@ -107,6 +107,8 @@ initialize_arch (void) #endif /* !__i386__ */ #ifdef __powerpc__ +#include "ppc-tdep.h" + static void initialize_arch (void) { @@ -320,24 +322,27 @@ void fetch_inferior_registers (int regno) { struct reg inferior_registers; +#ifdef PT_GETFPREGS struct fpreg inferior_fp_registers; +#endif int i; ptrace (PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) & inferior_registers, 0); - ptrace (PT_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); - for (i = 0; i < 32; i++) RF (i, inferior_registers.fixreg[i]); - RF (LR_REGNUM, inferior_registers.lr); - RF (CR_REGNUM, inferior_registers.cr); - RF (XER_REGNUM, inferior_registers.xer); - RF (CTR_REGNUM, inferior_registers.ctr); + RF (PPC_LR_REGNUM, inferior_registers.lr); + RF (PPC_CR_REGNUM, inferior_registers.cr); + RF (PPC_XER_REGNUM, inferior_registers.xer); + RF (PPC_CTR_REGNUM, inferior_registers.ctr); RF (PC_REGNUM, inferior_registers.pc); +#ifdef PT_GETFPREGS + ptrace (PT_GETFPREGS, inferior_pid, + (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); for (i = 0; i < 32; i++) RF (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]); +#endif } /* Store our register values back into the inferior. @@ -348,24 +353,27 @@ void store_inferior_registers (int regno) { struct reg inferior_registers; +#ifdef PT_SETFPREGS struct fpreg inferior_fp_registers; +#endif int i; for (i = 0; i < 32; i++) RS (i, inferior_registers.fixreg[i]); - RS (LR_REGNUM, inferior_registers.lr); - RS (CR_REGNUM, inferior_registers.cr); - RS (XER_REGNUM, inferior_registers.xer); - RS (CTR_REGNUM, inferior_registers.ctr); + RS (PPC_LR_REGNUM, inferior_registers.lr); + RS (PPC_CR_REGNUM, inferior_registers.cr); + RS (PPC_XER_REGNUM, inferior_registers.xer); + RS (PPC_CTR_REGNUM, inferior_registers.ctr); RS (PC_REGNUM, inferior_registers.pc); - - for (i = 0; i < 32; i++) - RS (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]); - ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) & inferior_registers, 0); + +#ifdef PT_SETFPREGS + for (i = 0; i < 32; i++) + RS (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]); ptrace (PT_SETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); +#endif } #endif /* !__powerpc__ */