From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: [rfc] Avoid MIPS port breakage on large registers
Date: Mon, 21 May 2007 13:05:00 -0000 [thread overview]
Message-ID: <20070521130529.GA1392@caradoc.them.org> (raw)
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
next reply other threads:[~2007-05-21 13:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-21 13:05 Daniel Jacobowitz [this message]
2007-05-21 14:01 ` Maciej W. Rozycki
2007-05-21 14:09 ` Daniel Jacobowitz
2007-06-13 17:25 ` Daniel Jacobowitz
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=20070521130529.GA1392@caradoc.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
/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