From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Multiarch NUM_REGS for MIPS
Date: Thu, 12 Dec 2002 16:42:00 -0000 [thread overview]
Message-ID: <1021213001947.ZM11112@localhost.localdomain> (raw)
I've just discovered that the ``finish'' command was broken on MIPS
due to the fact that gdbarch_num_regs must now be set for each
architecture. I.e, it's no longer sufficient for a target to simply
define NUM_REGS and assume that that'll work. (See
default_register_reggroup_p().) The patch below multiarches NUM_REGS
for MIPS. Tested on a remote mips64-linux target and on Irix 6.
Okay to commit?
* config/mips/tm-mips.h, config/mips/tm-irix3.h,
config/mips/tm-irix6.h (NUM_REGS): Delete.
* mips-tdep.c (mips_gdbarch_init): Call set_gdbarch_num_regs().
(temp_saved_regs): Declare as a pointer rather than an array.
(mips32_heuristic_proc_desc, heuristic_proc_desc): Make sure
that ``temp_saved_regs'' has storage allocated to it and that
it's the correct size.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.146
diff -u -p -r1.146 mips-tdep.c
--- mips-tdep.c 11 Dec 2002 02:26:36 -0000 1.146
+++ mips-tdep.c 13 Dec 2002 00:01:35 -0000
@@ -1714,7 +1714,7 @@ mips_frame_saved_pc (struct frame_info *
}
static struct mips_extra_func_info temp_proc_desc;
-static CORE_ADDR temp_saved_regs[NUM_REGS];
+static CORE_ADDR *temp_saved_regs;
/* Set a register's saved stack address in temp_saved_regs. If an address
has already been set for this register, do nothing; this way we will
@@ -2026,6 +2026,7 @@ mips32_heuristic_proc_desc (CORE_ADDR st
CORE_ADDR cur_pc;
CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for frame-pointer */
restart:
+ temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
PROC_FRAME_OFFSET (&temp_proc_desc) = 0;
PROC_FRAME_ADJUST (&temp_proc_desc) = 0; /* offset of FP from SP */
@@ -2134,6 +2135,7 @@ heuristic_proc_desc (CORE_ADDR start_pc,
if (start_pc == 0)
return NULL;
memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
+ temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM;
@@ -5756,6 +5758,11 @@ mips_gdbarch_init (struct gdbarch_info i
set_gdbarch_elf_make_msymbol_special (gdbarch,
mips_elf_make_msymbol_special);
+
+ if (osabi == GDB_OSABI_IRIX)
+ set_gdbarch_num_regs (gdbarch, 71);
+ else
+ set_gdbarch_num_regs (gdbarch, 90);
switch (mips_abi)
{
Index: config/mips/tm-irix3.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-irix3.h,v
retrieving revision 1.3
diff -u -p -r1.3 tm-irix3.h
--- config/mips/tm-irix3.h 11 Oct 2002 14:02:39 -0000 1.3
+++ config/mips/tm-irix3.h 13 Dec 2002 00:01:35 -0000
@@ -23,7 +23,6 @@
/* Redefine register numbers for SGI. */
-#undef NUM_REGS
#undef MIPS_REGISTER_NAMES
#undef FP0_REGNUM
#undef PC_REGNUM
@@ -33,10 +32,6 @@
#undef BADVADDR_REGNUM
#undef FCRCS_REGNUM
#undef FCRIR_REGNUM
-
-/* Number of machine registers */
-
-#define NUM_REGS 71
/* Initializer for an array of names of registers.
There should be NUM_REGS strings in this initializer. */
Index: config/mips/tm-irix6.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-irix6.h,v
retrieving revision 1.8
diff -u -p -r1.8 tm-irix6.h
--- config/mips/tm-irix6.h 11 Oct 2002 14:02:39 -0000 1.8
+++ config/mips/tm-irix6.h 13 Dec 2002 00:01:35 -0000
@@ -24,7 +24,6 @@
/* Redefine register numbers for SGI. */
-#undef NUM_REGS
#undef MIPS_REGISTER_NAMES
#undef FP0_REGNUM
#undef PC_REGNUM
@@ -34,10 +33,6 @@
#undef BADVADDR_REGNUM
#undef FCRCS_REGNUM
#undef FCRIR_REGNUM
-
-/* Number of machine registers */
-
-#define NUM_REGS 71
/* Initializer for an array of names of registers.
There should be NUM_REGS strings in this initializer. */
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.45
diff -u -p -r1.45 tm-mips.h
--- config/mips/tm-mips.h 21 Nov 2002 18:54:44 -0000 1.45
+++ config/mips/tm-mips.h 13 Dec 2002 00:01:35 -0000
@@ -59,12 +59,6 @@ extern int mips_step_skips_delay (CORE_A
#define MIPS_REGSIZE 4
#endif
-/* Number of machine registers */
-
-#ifndef NUM_REGS
-#define NUM_REGS 90
-#endif
-
/* Initializer for an array of names of registers.
There should be NUM_REGS strings in this initializer. */
next reply other threads:[~2002-12-13 0:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-12 16:42 Kevin Buettner [this message]
2002-12-13 0:42 ` Andrew Cagney
2002-12-13 12:21 ` 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=1021213001947.ZM11112@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