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]

Re: [patch/rfa/hppa] Use frame pointer for unwinding


> Randolph, this patch has a major style problem: assignments within an
> if-statement are frowned upon.  Can you fix that?

of course. is it ok otherwise?

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 15:33:48 -0000
@@ -1761,15 +1798,28 @@ 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)
+    fp = frame_unwind_register_unsigned (next_frame, HPPA_FP_REGNUM);
+
+    if (get_frame_type (next_frame) == NORMAL_FRAME
+        && u->Save_SP 
+	&& fp != 0)
+      {
+	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))
           {


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