Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: MIPS and builtin_type_{double,float}
@ 2002-03-22 11:17 Daniel Jacobowitz
  2002-03-22 11:33 ` Andrew Cagney
  2002-05-09 15:26 ` Daniel Jacobowitz
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-03-22 11:17 UTC (permalink / raw)
  To: Andrew Cagney, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

Rather than add the FIXME I owe you, I figured I'd fix at least most of
the (potential) problem.  This patch corrects explicit references to
registers to use the known IEEE floating-point types instead of
builtin_type_{float,double}.

OK?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

[-- Attachment #2: mips-double-register-types.patch --]
[-- Type: text/plain, Size: 4010 bytes --]

2002-03-22  Daniel Jacobowitz  <drow@mvista.com>

	* mips-tdep.c (mips_float_register_type): New function.
	(mips_double_register_type): New function.
	(mips_print_register): Use them.
	(do_fp_register_row): Likewise.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.67
diff -u -p -r1.67 mips-tdep.c
--- mips-tdep.c	2002/03/10 17:00:27	1.67
+++ mips-tdep.c	2002/03/22 19:10:34
@@ -289,6 +289,9 @@ static CORE_ADDR after_prologue (CORE_AD
 static void mips_read_fp_register_single (int regno, char *rare_buffer);
 static void mips_read_fp_register_double (int regno, char *rare_buffer);
 
+static struct type *mips_float_register_type (void);
+static struct type *mips_double_register_type (void);
+
 /* This value is the model of MIPS in use.  It is derived from the value
    of the PrID register.  */
 
@@ -2738,6 +2741,24 @@ mips_pop_frame (void)
    regs could be 32 bits wide in one frame and 64 on the frame above
    and below).  */
 
+static struct type *
+mips_float_register_type (void)
+{
+  if (TARGET_BYTE_ORDER == BFD_BIG_ENDIAN)
+    return builtin_type_ieee_single_big;
+  else
+    return builtin_type_ieee_single_little;
+}
+
+static struct type *
+mips_double_register_type (void)
+{
+  if (TARGET_BYTE_ORDER == BFD_BIG_ENDIAN)
+    return builtin_type_ieee_double_big;
+  else
+    return builtin_type_ieee_double_little;
+}
+
 /* Copy a 32-bit single-precision value from the current frame
    into rare_buffer.  */
 
@@ -2831,7 +2852,7 @@ mips_print_register (int regnum, int all
       mips_read_fp_register_double (regnum, dbuffer);
 
       printf_filtered ("(d%d: ", regnum - FP0_REGNUM);
-      val_print (builtin_type_double, dbuffer, 0, 0,
+      val_print (mips_double_register_type (), dbuffer, 0, 0,
 		 gdb_stdout, 0, 1, 0, Val_pretty_default);
       printf_filtered ("); ");
     }
@@ -2855,10 +2876,10 @@ mips_print_register (int regnum, int all
 	int offset = 4 * (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG);
 
 	printf_filtered (" (float) ");
-	val_print (builtin_type_float, raw_buffer + offset, 0, 0,
+	val_print (mips_float_register_type (), raw_buffer + offset, 0, 0,
 		   gdb_stdout, 0, 1, 0, Val_pretty_default);
 	printf_filtered (", (double) ");
-	val_print (builtin_type_double, raw_buffer, 0, 0,
+	val_print (mips_double_register_type (), raw_buffer, 0, 0,
 		   gdb_stdout, 0, 1, 0, Val_pretty_default);
       }
     else
@@ -2897,13 +2918,13 @@ do_fp_register_row (int regnum)
       /* 4-byte registers: we can fit two registers per row.  */
       /* Also print every pair of 4-byte regs as an 8-byte double.  */
       mips_read_fp_register_single (regnum, raw_buffer);
-      flt1 = unpack_double (builtin_type_float, raw_buffer, &inv1);
+      flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
 
       mips_read_fp_register_single (regnum + 1, raw_buffer);
-      flt2 = unpack_double (builtin_type_float, raw_buffer, &inv2);
+      flt2 = unpack_double (mips_float_register_type (), raw_buffer, &inv2);
 
       mips_read_fp_register_double (regnum, raw_buffer);
-      doub = unpack_double (builtin_type_double, raw_buffer, &inv3);
+      doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3);
       
       printf_filtered (" %-5s", REGISTER_NAME (regnum));
       if (inv1)
@@ -2931,10 +2952,10 @@ do_fp_register_row (int regnum)
     {
       /* Eight byte registers: print each one as float AND as double.  */
       mips_read_fp_register_single (regnum, raw_buffer);
-      flt1 = unpack_double (builtin_type_double, raw_buffer, &inv1);
+      flt1 = unpack_double (mips_double_register_type (), raw_buffer, &inv1);
 
       mips_read_fp_register_double (regnum, raw_buffer);
-      doub = unpack_double (builtin_type_double, raw_buffer, &inv3);
+      doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3);
       
       printf_filtered (" %-5s: ", REGISTER_NAME (regnum));
       if (inv1)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFA: MIPS and builtin_type_{double,float}
  2002-03-22 11:17 RFA: MIPS and builtin_type_{double,float} Daniel Jacobowitz
@ 2002-03-22 11:33 ` Andrew Cagney
  2002-03-22 11:37   ` Daniel Jacobowitz
  2002-05-09 15:26 ` Daniel Jacobowitz
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-03-22 11:33 UTC (permalink / raw)
  To: Daniel Jacobowitz, Martin M. Hunt, Chris; +Cc: gdb-patches

[Adding MartinH and CGD to To: line.> 2002-03-22  Daniel Jacobowitz 
<drow@mvista.com>
> 
> * mips-tdep.c (mips_float_register_type): New function.
> 	(mips_double_register_type): New function.
> 	(mips_print_register): Use them.
> 	(do_fp_register_row): Likewise.
> 

Perfect!  Suggest a NEWS entry.

The next question is pulling the whole thing into the branch.  The two 
(other) people that immediatly come to mind on this
  one are are MartinH and ChrisD.

Thoughts?

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFA: MIPS and builtin_type_{double,float}
  2002-03-22 11:33 ` Andrew Cagney
@ 2002-03-22 11:37   ` Daniel Jacobowitz
  2002-03-22 11:45     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-03-22 11:37 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Martin M. Hunt, Chris, gdb-patches

On Fri, Mar 22, 2002 at 02:33:25PM -0500, Andrew Cagney wrote:
> [Adding MartinH and CGD to To: line.> 2002-03-22  Daniel Jacobowitz 
> <drow@mvista.com>
> >
> >* mips-tdep.c (mips_float_register_type): New function.
> >	(mips_double_register_type): New function.
> >	(mips_print_register): Use them.
> >	(do_fp_register_row): Likewise.
> >
> 
> Perfect!  Suggest a NEWS entry.

Saying what?  It has no effect except preventative, since these were
always the existing types.

> The next question is pulling the whole thing into the branch.  The two 
> (other) people that immediatly come to mind on this
>  one are are MartinH and ChrisD.
> 
> Thoughts?

Confused thoughts.  What do you mean by "the whole thing" in this
context - the FP register-printing code that I originally posted which
prompted this correction?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFA: MIPS and builtin_type_{double,float}
  2002-03-22 11:37   ` Daniel Jacobowitz
@ 2002-03-22 11:45     ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-03-22 11:45 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Martin M. Hunt, Chris, gdb-patches

> On Fri, Mar 22, 2002 at 02:33:25PM -0500, Andrew Cagney wrote:
> 
>> [Adding MartinH and CGD to To: line.> 2002-03-22  Daniel Jacobowitz 
>> <drow@mvista.com>
> 
>> >
>> >* mips-tdep.c (mips_float_register_type): New function.
>> > (mips_double_register_type): New function.
>> > (mips_print_register): Use them.
>> > (do_fp_register_row): Likewise.
>> >
> 
>> 
>> Perfect!  Suggest a NEWS entry.
> 
> 
> Saying what?  It has no effect except preventative, since these were
> always the existing types.

I'm thinking of the entire change - fix the FP output and its types. 
The MIPS should be correctly displaying the FP values now.

>> The next question is pulling the whole thing into the branch.  The two 
>> (other) people that immediatly come to mind on this
>> one are are MartinH and ChrisD.
>> 
>> Thoughts?
> 
> 
> Confused thoughts.  What do you mean by "the whole thing" in this
> context - the FP register-printing code that I originally posted which
> prompted this correction?

Yes.

Andrew




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFA: MIPS and builtin_type_{double,float}
  2002-03-22 11:17 RFA: MIPS and builtin_type_{double,float} Daniel Jacobowitz
  2002-03-22 11:33 ` Andrew Cagney
@ 2002-05-09 15:26 ` Daniel Jacobowitz
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-05-09 15:26 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Cagney

On Fri, Mar 22, 2002 at 02:16:34PM -0500, Daniel Jacobowitz wrote:
> Rather than add the FIXME I owe you, I figured I'd fix at least most of
> the (potential) problem.  This patch corrects explicit references to
> registers to use the known IEEE floating-point types instead of
> builtin_type_{float,double}.
> 
> OK?
> 
> -- 
> Daniel Jacobowitz                           Carnegie Mellon University
> MontaVista Software                         Debian GNU/Linux Developer

> 2002-03-22  Daniel Jacobowitz  <drow@mvista.com>
> 
> 	* mips-tdep.c (mips_float_register_type): New function.
> 	(mips_double_register_type): New function.
> 	(mips_print_register): Use them.
> 	(do_fp_register_row): Likewise.

Oops, Andrew approved this and I dropped it on the floor.  Committed.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-05-09 22:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-22 11:17 RFA: MIPS and builtin_type_{double,float} Daniel Jacobowitz
2002-03-22 11:33 ` Andrew Cagney
2002-03-22 11:37   ` Daniel Jacobowitz
2002-03-22 11:45     ` Andrew Cagney
2002-05-09 15:26 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox