* [PATCH] mips-nat.c: Convert REGISTER_PTRACE_ADDR into a function
@ 2003-05-20 23:56 Kevin Buettner
0 siblings, 0 replies; only message in thread
From: Kevin Buettner @ 2003-05-20 23:56 UTC (permalink / raw)
To: gdb-patches
I've just committed the patch below.
* mips-nat.c (REGISTER_PTRACE_ADDR): Convert macro to function
register_ptrace_addr(). Fix all callers.
Index: mips-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-nat.c,v
retrieving revision 1.11
diff -u -p -r1.11 mips-nat.c
--- mips-nat.c 8 May 2003 22:33:14 -0000 1.11
+++ mips-nat.c 20 May 2003 23:50:51 -0000
@@ -51,16 +51,19 @@
/* Map gdb internal register number to ptrace ``address''.
These ``addresses'' are defined in DECstation <sys/ptrace.h> */
-#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));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-20 23:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-20 23:56 [PATCH] mips-nat.c: Convert REGISTER_PTRACE_ADDR into a function Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox