From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] mips-nat.c: Convert REGISTER_PTRACE_ADDR into a function
Date: Tue, 20 May 2003 23:56:00 -0000 [thread overview]
Message-ID: <1030520235642.ZM3932@localhost.localdomain> (raw)
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));
reply other threads:[~2003-05-20 23:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1030520235642.ZM3932@localhost.localdomain \
--to=kevinb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox