From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23298 invoked by alias); 21 May 2007 13:05:40 -0000 Received: (qmail 23287 invoked by uid 22791); 21 May 2007 13:05:38 -0000 X-Spam-Check-By: sourceware.org Received: from return.false.org (HELO return.false.org) (66.207.162.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 21 May 2007 13:05:31 +0000 Received: from return.false.org (localhost [127.0.0.1]) by return.false.org (Postfix) with ESMTP id 9C9AF4B267 for ; Mon, 21 May 2007 08:05:29 -0500 (CDT) Received: from caradoc.them.org (dsl093-172-095.pit1.dsl.speakeasy.net [66.93.172.95]) by return.false.org (Postfix) with ESMTP id 5EA1F4B262 for ; Mon, 21 May 2007 08:05:29 -0500 (CDT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1Hq7Zp-0000NL-2b for gdb-patches@sourceware.org; Mon, 21 May 2007 09:05:29 -0400 Date: Mon, 21 May 2007 13:05:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: [rfc] Avoid MIPS port breakage on large registers Message-ID: <20070521130529.GA1392@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-05/txt/msg00334.txt.bz2 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 * 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