This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] mips: Fix "info registers" output


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]