From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Use correct register names for MIPS n32/n64 ABIs
Date: Tue, 18 Mar 2003 23:41:00 -0000 [thread overview]
Message-ID: <1030318234150.ZM25965@localhost.localdomain> (raw)
For an Irix 6 target, when debugging an o32 program, gdb does not
provide the correct register names when using "info registers".
It does however, use the correct names for n32/n64. Conversely, for
all other MIPS targets, o32 register names are always used regardless
of the ABI.
The patch below causes the correct ABI-dependent register names to be
used.
I considered at least one other approach for fixing this problem. I
considered providing new register name arrays for each of the ABIs,
but that seemed unwieldy, and quite unnecessary too since the GPR
register numbers are always 0-31. Also, all mips cores (that gdb
knows about) agree on what these names should be for the o32 ABI. As
such, it seemed easier to remap just the names of the GPRs in
mips_register_name().
Another follow on patch to this one would be to encode the knowledge
of what the GPRs should be entirely within mips_register_name() and
relegate the register name arrays to describing (only) the names of
registers whose numbers are 32 or greater. (I'll wait to do this
until I find out the reaction to the patch below.)
Okay?
* mips-tdep.c (mips_register_name): Provide correct names for
n32/n64 ABI.
* config/mips/tm-irix6.h (MIPS_REGISTER_NAMES): Change names
to those used by o32 ABI. The correct names for the n32/n64 ABIs
are now handled by mips_register_name().
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.172
diff -u -p -r1.172 mips-tdep.c
--- mips-tdep.c 14 Mar 2003 16:05:35 -0000 1.172
+++ mips-tdep.c 18 Mar 2003 23:19:13 -0000
@@ -368,7 +368,23 @@ char **mips_processor_reg_names = mips_g
static const char *
mips_register_name (int i)
{
- return mips_processor_reg_names[i];
+ static char *mips_n32_n64_gpr_names[] = {
+ "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
+ "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3",
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
+ };
+ enum mips_abi abi = mips_abi (current_gdbarch);
+
+ /* The MIPS general purpose registers are always mapped from 0 to 31. The
+ names of the registers (which reflects the conventions regarding
+ register use) vary depending on the ABI. We assume that the names
+ accessible via mips_processor_reg_names[] are always the non-n32/n64
+ names. */
+ if (i < 32 && (abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64))
+ return mips_n32_n64_gpr_names[i];
+ else
+ return mips_processor_reg_names[i];
}
/* *INDENT-OFF* */
/* Names of IDT R3041 registers. */
Index: config/mips/tm-irix6.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-irix6.h,v
retrieving revision 1.9
diff -u -p -r1.9 tm-irix6.h
--- config/mips/tm-irix6.h 13 Dec 2002 18:09:30 -0000 1.9
+++ config/mips/tm-irix6.h 18 Mar 2003 23:19:14 -0000
@@ -35,11 +35,15 @@
#undef FCRIR_REGNUM
/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
+ There should be NUM_REGS strings in this initializer.
+
+ Note: These are actually the names used by the o32 ABI.
+ mips_register_name() in mips-tdep.c is responsible for remapping
+ the names which differ in the n32/n64 ABI. */
#define MIPS_REGISTER_NAMES \
{ "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
- "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3", \
+ "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
"t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
next reply other threads:[~2003-03-18 23:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-18 23:41 Kevin Buettner [this message]
2003-03-19 1:46 ` Andrew Cagney
2003-03-19 6:39 ` Kevin Buettner
2003-03-19 6:51 ` Kevin Buettner
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=1030318234150.ZM25965@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