From 92b3541e35c0f2803fcb02a92c25c9ca2c41f3d8 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Tue, 20 May 2003 23:54:34 +0000 Subject: [PATCH] * mips-nat.c (REGISTER_PTRACE_ADDR): Convert macro to function register_ptrace_addr(). Fix all callers. --- gdb/ChangeLog | 5 +++++ gdb/mips-nat.c | 27 +++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f1788868a26..9cf50e6ec02 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2003-05-20 Kevin Buettner + + * mips-nat.c (REGISTER_PTRACE_ADDR): Convert macro to function + register_ptrace_addr(). Fix all callers. + 2003-05-21 Andreas Schwab * Makefile.in (m68k-tdep.o, m68klinux-tdep.o): Update diff --git a/gdb/mips-nat.c b/gdb/mips-nat.c index 1a29c3e317a..e370534f38c 100644 --- a/gdb/mips-nat.c +++ b/gdb/mips-nat.c @@ -51,16 +51,19 @@ /* Map gdb internal register number to ptrace ``address''. These ``addresses'' are defined in DECstation */ -#define REGISTER_PTRACE_ADDR(regno) \ - (regno < 32 ? GPR_BASE + regno \ - : regno == PC_REGNUM ? PC \ - : regno == CAUSE_REGNUM ? CAUSE \ - : regno == HI_REGNUM ? MMHI \ - : regno == LO_REGNUM ? MMLO \ - : regno == FCRCS_REGNUM ? FPC_CSR \ - : regno == FCRIR_REGNUM ? FPC_EIR \ - : regno >= FP0_REGNUM ? FPR_BASE + (regno - FP0_REGNUM) \ - : 0) +static int +register_ptrace_addr (int regno) +{ + return (regno < 32 ? GPR_BASE + regno + : regno == PC_REGNUM ? PC + : regno == CAUSE_REGNUM ? CAUSE + : regno == HI_REGNUM ? MMHI + : regno == LO_REGNUM ? MMLO + : regno == FCRCS_REGNUM ? FPC_CSR + : regno == FCRIR_REGNUM ? FPC_EIR + : regno >= FP0_REGNUM ? FPR_BASE + (regno - FP0_REGNUM) + : 0); +} static void fetch_core_registers (char *, unsigned, int, CORE_ADDR); @@ -79,7 +82,7 @@ fetch_inferior_registers (int regno) for (regno = 1; regno < NUM_REGS; regno++) { - regaddr = REGISTER_PTRACE_ADDR (regno); + regaddr = register_ptrace_addr (regno); for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { *(int *) &buf[i] = ptrace (PT_READ_U, PIDGET (inferior_ptid), @@ -111,7 +114,7 @@ store_inferior_registers (int regno) || regno == FCRIR_REGNUM || regno == DEPRECATED_FP_REGNUM || (regno >= FIRST_EMBED_REGNUM && regno <= LAST_EMBED_REGNUM)) return; - regaddr = REGISTER_PTRACE_ADDR (regno); + regaddr = register_ptrace_addr (regno); errno = 0; ptrace (PT_WRITE_U, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); -- 2.30.2