[commit] Improve backtrace check

Daniel Jacobowitz drow@false.org
Mon Sep 24 21:38:00 GMT 2007


A while ago I added a check for useless frames: if two frames have
"saved" the PC to the same stack slot, then we don't really know where
they saved it so we should give up.  This patch does the same thing
for the case where no stack is involved.  If the top function on the
stack confuses GDB, on a target which uses a dedicated return
register, then the PC will stay in that register for consecutive
frames.  If we actually knew where it was saved, we would have an
lval_memory involved.

Tested by hand on MIPS64, and through the testsuite on x86_64-linux.
Committed to trunk.

-- 
Daniel Jacobowitz
CodeSourcery

2007-09-24  Daniel Jacobowitz  <dan@codesourcery.com>

	* frame.c (get_prev_frame_1): Also check for PC in the same register.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.231
diff -u -p -r1.231 frame.c
--- frame.c	23 Aug 2007 18:08:31 -0000	1.231
+++ frame.c	24 Sep 2007 20:53:42 -0000
@@ -1231,7 +1231,7 @@ get_prev_frame_1 (struct frame_info *thi
       && get_frame_type (this_frame) == NORMAL_FRAME
       && get_frame_type (this_frame->next) == NORMAL_FRAME)
     {
-      int optimized, realnum;
+      int optimized, realnum, nrealnum;
       enum lval_type lval, nlval;
       CORE_ADDR addr, naddr;
 
@@ -1240,9 +1240,10 @@ get_prev_frame_1 (struct frame_info *thi
 				      &optimized, &lval, &addr, &realnum);
       frame_register_unwind_location (get_next_frame (this_frame),
 				      gdbarch_pc_regnum (current_gdbarch),
-				      &optimized, &nlval, &naddr, &realnum);
+				      &optimized, &nlval, &naddr, &nrealnum);
 
-      if (lval == lval_memory && lval == nlval && addr == naddr)
+      if (lval == lval_memory && lval == nlval && addr == naddr
+	  || lval == lval_register && lval == nlval && realnum == nrealnum)
 	{
 	  if (frame_debug)
 	    {



More information about the Gdb-patches mailing list