Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: gdb-patches@sources.redhat.com
Subject: [patch/rfa/hppa] Use frame pointer for unwinding
Date: Sun, 16 May 2004 02:07:00 -0000	[thread overview]
Message-ID: <20040516020703.GZ566@tausq.org> (raw)

One more patch --

Currently we don't use the frame pointer to unwind the stack, we rely
only on unwinding records. However, this doesn't work for functions that
call alloca() because the unwinding record does not account for the
variable-sized stack frame. In this case, the ABI requires that the
compiler always maintain a frame pointer.

Fixes these two FAILs from the testsuite, no new regressions.
+PASS: gdb.base/funcargs.exp: backtrace from call_after_alloca_subr
+PASS: gdb.base/selftest.exp: backtrace through signal handler

ok to apply?
randolph


2004-05-15  Randolph Chung  <tausq@debian.org>

	* hppa-tdep.c (hppa_frame_cache): If a frame pointer is available, use
	it for unwinding the stack.

Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.156
diff -u -p -r1.156 hppa-tdep.c
--- hppa-tdep.c	8 May 2004 03:59:34 -0000	1.156
+++ hppa-tdep.c	16 May 2004 01:42:56 -0000
@@ -1761,15 +1798,26 @@ hppa_frame_cache (struct frame_info *nex
        the current function (and is thus equivalent to the "saved"
        stack pointer.  */
     CORE_ADDR this_sp = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+    CORE_ADDR fp;
 
    if (hppa_debug)
       fprintf_unfiltered (gdb_stdlog, " (this_sp=0x%s, pc=0x%s, "
 		          "prologue_end=0x%s) ",
 		          paddr_nz (this_sp),
 			  paddr_nz (frame_pc_unwind (next_frame)),
 			  paddr_nz (prologue_end));
 
-    if (frame_pc_unwind (next_frame) >= prologue_end)
+    if (get_frame_type (next_frame) == NORMAL_FRAME
+        && u->Save_SP 
+	&& (fp = frame_unwind_register_unsigned (next_frame, HPPA_FP_REGNUM)))
+      {
+	cache->base = fp;
+
+	if (hppa_debug)
+	  fprintf_unfiltered (gdb_stdlog, " (base=0x%s) [frame pointer] }",
+			      paddr_nz (cache->base));
+      }
+    else if (frame_pc_unwind (next_frame) >= prologue_end)
       {
         if (u->Save_SP && trad_frame_addr_p (cache->saved_regs, HPPA_SP_REGNUM))
           {

-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


             reply	other threads:[~2004-05-16  2:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-16  2:07 Randolph Chung [this message]
2004-05-16 10:36 ` Mark Kettenis
2004-05-16 15:36   ` Randolph Chung
2004-05-16 16:22     ` Mark Kettenis
2004-05-16 16:42       ` Randolph Chung
2004-05-16 16:32 ` Andrew Cagney
2004-05-16 17:03   ` Randolph Chung
2004-05-17  0:13     ` Randolph Chung
2004-05-17  2:34       ` Randolph Chung
2004-05-17 15:23         ` Andrew Cagney
2004-05-17 16:01           ` Randolph Chung
2004-05-17 17:27             ` Andrew Cagney
2004-05-17 15:13     ` Andrew Cagney
2004-05-17 16:13 John David Anglin
2004-05-17 17:14 John David Anglin
2004-05-17 17:28 ` Randolph Chung
2004-05-17 17:54   ` John David Anglin

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=20040516020703.GZ566@tausq.org \
    --to=randolph@tausq.org \
    --cc=gdb-patches@sources.redhat.com \
    /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