This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] Avoid MIPS port breakage on large registers
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org
- Date: Mon, 21 May 2007 09:05:29 -0400
- Subject: [rfc] Avoid MIPS port breakage on large registers
I am about to post target-described register support for the MIPS
port. One thing I noticed while testing it was that "info registers"
went off into the woods on O32 when I added an extra 64-bit register;
there's an unsigned loop until regsize - abi_regsize, which is
supposed to catch 32-bit registers on N64, but runs almost forever
given a 64-bit integer register on O32. This patch just prints such
registers on their own row.
Any comments? Otherwise, I'll commit along with the other register
description bits.
--
Daniel Jacobowitz
CodeSourcery
2007-05-21 Daniel Jacobowitz <dan@codesourcery.com>
* mips-tdep.c (mips_print_register): Remove unused ALL argument.
(print_gp_register_row): Stop before printing a register bigger
than the ABI register size.
(mips_print_registers_info): Update call to mips_print_register.
---
mips-tdep.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
Index: gdb/mips-tdep.c
===================================================================
--- gdb.orig/mips-tdep.c 2007-05-18 14:35:04.000000000 -0400
+++ gdb/mips-tdep.c 2007-05-18 14:58:34.000000000 -0400
@@ -3886,7 +3886,7 @@ mips_print_fp_register (struct ui_file *
static void
mips_print_register (struct ui_file *file, struct frame_info *frame,
- int regnum, int all)
+ int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte raw_buffer[MAX_REGISTER_SIZE];
@@ -3964,6 +3964,18 @@ print_gp_register_row (struct ui_file *f
if (TYPE_CODE (register_type (gdbarch, regnum)) ==
TYPE_CODE_FLT)
break; /* end the row: reached FP register */
+ /* Large registers are handled separately. */
+ if (register_size (current_gdbarch, regnum)
+ > mips_abi_regsize (current_gdbarch))
+ {
+ if (col > 0)
+ break; /* End the row before this register. */
+
+ /* Print this register on a row by itself. */
+ mips_print_register (file, frame, regnum);
+ fprintf_filtered (file, "\n");
+ return regnum + 1;
+ }
if (col == 0)
fprintf_filtered (file, " ");
fprintf_filtered (file,
@@ -3990,6 +4002,10 @@ print_gp_register_row (struct ui_file *f
if (TYPE_CODE (register_type (gdbarch, regnum)) ==
TYPE_CODE_FLT)
break; /* end row: reached FP register */
+ if (register_size (current_gdbarch, regnum)
+ > mips_abi_regsize (current_gdbarch))
+ break; /* End row: large register. */
+
/* OK: get the data in raw format. */
if (!frame_register_read (frame, regnum, raw_buffer))
error (_("can't read register %d (%s)"), regnum, REGISTER_NAME (regnum));
@@ -4030,7 +4046,7 @@ mips_print_registers_info (struct gdbarc
if (*(REGISTER_NAME (regnum)) == '\0')
error (_("Not a valid register for the current processor type"));
- mips_print_register (file, frame, regnum, 0);
+ mips_print_register (file, frame, regnum);
fprintf_filtered (file, "\n");
}
else