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]

[RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions


When using dwarf2 debug info, floating point registers are mapped
incorrectly for certain mips targets.  It turns out that Irix is the
only one that's getting it right due to the fact that FP0_REGNUM is
defined to be 32.

Thanks to Chris Demetriou for diagnosing this problem and suggesting
the solution.

[Note: Irix cross some other mips target is currently broken due to
the fact that FP0_REGNUM is not multiarched yet.]

Okay?

	* mips-tdep.c (mips_dwarf_reg_to_regnum, mips_dwarf2_reg_to_regnum):
	New functions.
	(mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum()
	and set_gdbarch_dwarf2_reg_to_regnum().

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.168
diff -u -p -r1.168 mips-tdep.c
--- mips-tdep.c	3 Mar 2003 20:50:19 -0000	1.168
+++ mips-tdep.c	4 Mar 2003 17:25:21 -0000
@@ -5563,6 +5563,29 @@ mips_ecoff_reg_to_regnum (int num)
     return num + FP0_REGNUM - 32;
 }
 
+/* Convert a dwarf register number to a gdb REGNUM */
+
+static int
+mips_dwarf_reg_to_regnum (int num)
+{
+  if (num < 32)
+    return num;
+  else
+    return num + FP0_REGNUM - 32;
+}
+
+/* Convert a dwarf2 register number to a gdb REGNUM */
+
+static int
+mips_dwarf2_reg_to_regnum (int num)
+{
+  if (num < 32)
+    return num;
+  else
+    return num + FP0_REGNUM - 32;
+}
+
+
 /* Convert an integer into an address.  By first converting the value
    into a pointer and then extracting it signed, the address is
    guarenteed to be correctly sign extended.  */
@@ -5980,6 +6003,8 @@ mips_gdbarch_init (struct gdbarch_info i
   /* Map debug register numbers onto internal register numbers.  */
   set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
   set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
+  set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_reg_to_regnum);
+  set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf2_reg_to_regnum);
 
   /* Initialize a frame */
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);


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