This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] Multiarch NUM_REGS for MIPS
- From: Kevin Buettner <kevinb at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 12 Dec 2002 17:19:48 -0700
- Subject: [RFA] Multiarch NUM_REGS for MIPS
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. */