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]

[RFA] Fix backtrace/1435


This patch fixes backtrace/1435.  The failure occurs when main
immediately follows a function (say foo) which has its epilogue
optimized out by the compiler.  In that case the backtrace will be
terminated prematurely since get_frame_pc on foo's frame will return
the address of the first instruction of main.  This can be fixed by
using get_frame_address_in_block.

Ok to check this in?

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* frame.c (get_prev_frame): Use result from
	get_frame_address_in_block instead of get_frame_pc as argument to
	inside_main_func.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.147
diff -u -p -r1.147 frame.c
--- frame.c 24 Oct 2003 17:37:03 -0000 1.147
+++ frame.c 17 Nov 2003 21:02:40 -0000
@@ -1792,7 +1792,7 @@ get_prev_frame (struct frame_info *this_
 
   if (this_frame->level >= 0
       && !backtrace_past_main
-      && inside_main_func (get_frame_pc (this_frame)))
+      && inside_main_func (get_frame_address_in_block (this_frame)))
     /* Don't unwind past main(), bug always unwind the sentinel frame.
        Note, this is done _before_ the frame has been marked as
        previously unwound.  That way if the user later decides to


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