Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@mips.com>
To: gdb-patches@sourceware.org
Cc: Chris Dearman <chris@mips.com>,
	"Maciej W. Rozycki" <macro@linux-mips.org>
Subject: mips-tdep.c: Fix retrieval of the virtual frame pointer
Date: Fri, 28 Sep 2007 17:46:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0709281818470.670@perivale.mips.com> (raw)

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;


             reply	other threads:[~2007-09-28 17:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28 17:46 Maciej W. Rozycki [this message]
2007-09-28 17:57 ` Daniel Jacobowitz
2007-09-28 18:14   ` Maciej W. Rozycki
2007-09-28 18:19     ` Daniel Jacobowitz
2007-10-01 11:27       ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0709281818470.670@perivale.mips.com \
    --to=macro@mips.com \
    --cc=chris@mips.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox