This is the mail archive of the gdb-patches@sourceware.org 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]

mips-tdep.c: Fix retrieval of the virtual frame pointer


Hello,

 A number of test cases in the gdb.trace/ subset fail with an error like 
this:

(gdb) actions
Enter actions for tracepoint 1, one per line.
End with a line saying just "end".
> collect parm[0], parm[1], parm[2], parm[3]
/n/bank/raid/macro/src7-mdi/combined/gdb/arch-utils.c:200: internal-error: No virtual frame pointer available
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.trace/packetlen.exp: setup collect actions
FAIL: gdb.trace/packetlen.exp: survive the long packet send (GDB internal error)

The reason seems to be legacy_virtual_frame_pointer() assuming the raw and 
cooked numbers for the frame pointer register are the same.  This is not 
the case for MIPS.

 Tested using the mipsisa32-sde-elf target, with the mips-sim-sde32/-EB 
and mips-sim-sde32/-EL boards, fixing 19 regressions.

2007-09-28  Chris Dearman  <chris@mips.com>
            Maciej W. Rozycki  <macro@mips.com>

	* mips-tdep.c (mips_virtual_frame_pointer): New function.
	(mips_gdbarch_init): Set virtual_frame_pointer function.

 OK to apply?

  Maciej

12593.diff
Index: binutils-quilt/src/gdb/mips-tdep.c
===================================================================
--- binutils-quilt.orig/src/gdb/mips-tdep.c	2007-09-28 16:07:41.000000000 +0100
+++ binutils-quilt/src/gdb/mips-tdep.c	2007-09-28 18:26:52.000000000 +0100
@@ -5006,6 +5006,25 @@
   return value_of_register (*reg_p, frame);
 }
 
+/* The default legacy_virtual_frame_pointer function checks register
+   numbers against gdbarch_num_regs which doesn't work for us...  */
+
+static void
+mips_virtual_frame_pointer (CORE_ADDR pc,
+			    int *frame_regnum, LONGEST *frame_offset)
+{
+  if (gdbarch_deprecated_fp_regnum (current_gdbarch) >= 0)
+    *frame_regnum = gdbarch_deprecated_fp_regnum (current_gdbarch);
+  else if (MIPS_SP_REGNUM >= 0)
+    *frame_regnum = MIPS_SP_REGNUM;
+  else
+    /* Should this be an internal error?  I guess so, it is reflecting
+       an architectural limitation in the current design.  */
+    internal_error (__FILE__, __LINE__,
+		    _("No virtual frame pointer available"));
+  *frame_offset = 0;
+}
+
 static struct gdbarch *
 mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -5353,6 +5372,8 @@
   set_gdbarch_elf_make_msymbol_special (gdbarch,
 					mips_elf_make_msymbol_special);
 
+  set_gdbarch_virtual_frame_pointer (gdbarch, mips_virtual_frame_pointer);
+
   /* Fill in the OS dependant register numbers and names.  */
   {
     const char **reg_names;


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