From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23361 invoked by alias); 7 Mar 2002 21:59:57 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 23294 invoked from network); 7 Mar 2002 21:59:54 -0000 Received: from unknown (HELO nevyn.them.org) (128.2.145.6) by sources.redhat.com with SMTP; 7 Mar 2002 21:59:54 -0000 Received: from drow by nevyn.them.org with local (Exim 3.34 #1 (Debian)) id 16j5vY-00061N-00; Thu, 07 Mar 2002 16:59:56 -0500 Date: Thu, 07 Mar 2002 13:59:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Cc: ac131313@cygnus.com Subject: Re: [RFA] mips: Fix "info registers" output Message-ID: <20020307165956.A22042@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com, ac131313@cygnus.com References: <20010619225007.A10141@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010619225007.A10141@nevyn.them.org> User-Agent: Mutt/1.3.23i X-SW-Source: 2002-03/txt/msg00107.txt.bz2 On Tue, Jun 19, 2001 at 10:50:07PM -0700, Daniel Jacobowitz wrote: > There were some pretty nasty problems in the FP register printing code, and > a potential formatting problem in the GP register printing code. How > does this look to correct them? > > 2001-06-19 Daniel Jacobowitz > * mips-tdep.c (do_fp_register_row): Convert to use > REGISTER_CONVERT_TO_TYPE. > (do_gp_register_row): Only add whitespace if registers > were printed. This patch got bogged down in details. Rather than reposting it (there are still several memory corruption bugs in do_fp_register_row) I'm just submitting an obvious fix for the one that was biting me. I think the function should be killed in favor of something involving gdbarch, but this fixes the immediate problem and I do not see an appropriate gdbarch method. To recap: On o32 MIPS systems, $f0 and $f1 are 32-bit values. $d0 (well, $f0 accessed by a .d instruction, generally) is a 64-bit value involving both of them. If you want to read $f0 as a double, you want $d0. GDB only supports two ways to see this: info registers f0 or info all-registers. We don't actually have a name for this value. The best fix would probably be to introduce $d0 as a pseudo register, but I can't think how to do that without running into other problems on systems with 64-bit FP registers. Meanwhile, Andrew, is this trivial fix OK? It just makes us decode the actual register values instead of two host pointers in our call to unpack_double. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer 2002-03-07 Daniel Jacobowitz * mips-tdep.c (do_fp_register_row): Print composite double-precision registers correctly. Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.66 diff -u -p -r1.66 mips-tdep.c --- mips-tdep.c 2002/02/20 22:51:41 1.66 +++ mips-tdep.c 2002/03/07 21:48:44 @@ -2777,9 +2777,11 @@ do_fp_register_row (int regnum) regnum + 1, REGISTER_NAME (regnum + 1)); /* copy the two floats into one double, and unpack both */ - memcpy (dbl_buffer, raw_buffer, 2 * REGISTER_RAW_SIZE (FP0_REGNUM)); flt1 = unpack_double (builtin_type_float, raw_buffer[HI], &inv1); flt2 = unpack_double (builtin_type_float, raw_buffer[LO], &inv2); + memcpy (dbl_buffer, raw_buffer[HI], REGISTER_RAW_SIZE (FP0_REGNUM)); + memcpy (dbl_buffer + REGISTER_RAW_SIZE (FP0_REGNUM), + raw_buffer[LO], REGISTER_RAW_SIZE (FP0_REGNUM)); doub = unpack_double (builtin_type_double, dbl_buffer, &inv3); printf_filtered (" %-5s", REGISTER_NAME (regnum));