Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com
Cc: ac131313@cygnus.com
Subject: Re: [RFA] mips: Fix "info registers" output
Date: Thu, 07 Mar 2002 13:59:00 -0000	[thread overview]
Message-ID: <20020307165956.A22042@nevyn.them.org> (raw)
In-Reply-To: <20010619225007.A10141@nevyn.them.org>

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  <drow@mvista.com>
> 	* 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  <drow@mvista.com>

	* 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));


  parent reply	other threads:[~2002-03-07 21:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20010619225007.A10141@nevyn.them.org>
2001-06-20  7:19 ` Andrew Cagney
2001-06-21  0:45 ` Eli Zaretskii
2001-06-21  8:37   ` Daniel Jacobowitz
2001-06-21  9:29     ` Eli Zaretskii
2001-06-21  9:44       ` Daniel Jacobowitz
2001-06-21 12:00         ` Eli Zaretskii
2001-06-21 13:12           ` Daniel Jacobowitz
2001-06-21 14:22           ` Don Howard
2002-03-07 13:59 ` Daniel Jacobowitz [this message]
2002-03-09 18:05   ` Andrew Cagney
2002-03-09 22:58     ` Daniel Jacobowitz
2002-03-10  8:30       ` Andrew Cagney
2002-03-10  9:00         ` Daniel Jacobowitz
2002-03-10  9:46           ` Andrew Cagney
2002-03-10 11:30             ` Daniel Jacobowitz
2002-03-10 12:45               ` Andrew Cagney
2002-03-10 14:26                 ` Daniel Jacobowitz
2002-03-10 15:18                   ` Andrew Cagney

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=20020307165956.A22042@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    /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