Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] MIPS virtual frame pointer, info float
@ 2007-10-02 15:17 Daniel Jacobowitz
  2007-10-02 16:13 ` Maciej W. Rozycki
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-10-02 15:17 UTC (permalink / raw)
  To: gdb-patches

I have committed this patch after testing on mipsel-linux.  It fixes
two problems; the gdb.trace failures that Maciej reported last week,
and obviously wrong output from "info float":

f0:  0xffffffff flt: nan
f1:  0xffffffff flt: nan               dbl: nan

We were checking the difference between the current register and the
saved f0 regnum.  But there's an extra NUM_REGS involved, so if
NUM_REGS happens to be odd....

-- 
Daniel Jacobowitz
CodeSourcery

2007-10-02  Daniel Jacobowitz  <dan@codesourcery.com>

	* mips-tdep.c (mips_read_fp_register_double): Correct check for
	odd FP registers.
	(mips_print_fp_register): Correct check for even FP registers.
	(mips_virtual_frame_pointer): New function.
	(mips_gdbarch_init): Call set_gdbarch_virtual_frame_pointer.

Index: gdb/mips-tdep.c
===================================================================
--- gdb/mips-tdep.c	(revision 182501)
+++ gdb/mips-tdep.c	(working copy)
@@ -4006,7 +4006,9 @@ mips_read_fp_register_double (struct fra
     }
   else
     {
-      if ((regno - mips_regnum (current_gdbarch)->fp0) & 1)
+      int rawnum = regno % gdbarch_num_regs (current_gdbarch);
+
+      if ((rawnum - mips_regnum (current_gdbarch)->fp0) & 1)
 	internal_error (__FILE__, __LINE__,
 			_("mips_read_fp_register_double: bad access to "
 			"odd-numbered FP register"));
@@ -4060,7 +4062,7 @@ mips_print_fp_register (struct ui_file *
       else
 	fprintf_filtered (file, "%-17.9g", flt1);
 
-      if (regnum % 2 == 0)
+      if ((regnum - gdbarch_num_regs (current_gdbarch)) % 2 == 0)
 	{
 	  mips_read_fp_register_double (frame, regnum, raw_buffer);
 	  doub = unpack_double (mips_double_register_type (), raw_buffer,
@@ -4785,6 +4787,18 @@ mips_integer_to_address (struct gdbarch 
   return (CORE_ADDR) extract_signed_integer (buf, TYPE_LENGTH (type));
 }
 
+/* Dummy virtual frame pointer method.  This is no more or less accurate
+   than most other architectures; we just need to be explicit about it,
+   because the pseudo-register gdbarch_sp_regnum will otherwise lead to
+   an assertion failure.  */
+
+static void
+mips_virtual_frame_pointer (CORE_ADDR pc, int *reg, LONGEST *offset)
+{
+  *reg = MIPS_SP_REGNUM;
+  *offset = 0;
+}
+
 static void
 mips_find_abi_section (bfd *abfd, asection *sect, void *obj)
 {
@@ -5280,6 +5294,7 @@ mips_gdbarch_init (struct gdbarch_info i
     set_gdbarch_num_regs (gdbarch, num_regs);
     set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
     set_gdbarch_register_name (gdbarch, mips_register_name);
+    set_gdbarch_virtual_frame_pointer (gdbarch, mips_virtual_frame_pointer);
     tdep->mips_processor_reg_names = reg_names;
     tdep->regnum = regnum;
   }


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

* Re: [commit] MIPS virtual frame pointer, info float
  2007-10-02 15:17 [commit] MIPS virtual frame pointer, info float Daniel Jacobowitz
@ 2007-10-02 16:13 ` Maciej W. Rozycki
  2007-10-02 16:18   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej W. Rozycki @ 2007-10-02 16:13 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

On Tue, 2 Oct 2007, Daniel Jacobowitz wrote:

> We were checking the difference between the current register and the
> saved f0 regnum.  But there's an extra NUM_REGS involved, so if
> NUM_REGS happens to be odd....

 Oh, that thing!  Thanks for fixing it, though I have some changes in this 
area in my queue as well. ;-)  Now I need to catch up after your recent 
watchpoint revamp...

  Maciej


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

* Re: [commit] MIPS virtual frame pointer, info float
  2007-10-02 16:13 ` Maciej W. Rozycki
@ 2007-10-02 16:18   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-10-02 16:18 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gdb-patches

On Tue, Oct 02, 2007 at 05:13:26PM +0100, Maciej W. Rozycki wrote:
>  Oh, that thing!  Thanks for fixing it, though I have some changes in this 
> area in my queue as well. ;-)  Now I need to catch up after your recent 
> watchpoint revamp...

:-)

I still have a long list of things to fix, but I've now flushed out
all of my tested patches (as far as I know).

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-10-02 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-02 15:17 [commit] MIPS virtual frame pointer, info float Daniel Jacobowitz
2007-10-02 16:13 ` Maciej W. Rozycki
2007-10-02 16:18   ` Daniel Jacobowitz

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