Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* infrun.c:restore_selected_frame???
@ 2002-04-03 15:50 Jim Ingham
  2002-04-08 16:26 ` infrun.c:restore_selected_frame??? Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Ingham @ 2002-04-03 15:50 UTC (permalink / raw)
  To: gdb-patches

Hi, all...

I am totally confused by restore_selected_frame.  Why is it calling 
find_relative_frame, passing in the current frame and level?  Remember, 
level comes from a stored value of selected_frame_level.  
selected_frame_level is set in select_frame, and is either an absolute 
frame level, or -1 if the caller of select_frame was just selecting by 
frame_info and doesn't care about the level (which is done in a number 
of places).  So it is NOT a relative level at all, certainly not 
relative to whatever the current frame happens to be except by 
accident...

Since you also have the frame address sitting around in the 
restore_selected_frame_args, why not use it to find the frame instead?  
The patch below works for me, and eliminates a bunch of errant kvetching 
about "Unable to restore selected frame"...

Does this seem right?

Jim

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.56
diff -c -w -r1.56 infrun.c
*** infrun.c    2002/03/18 02:26:31     1.56
--- infrun.c    2002/04/03 23:42:52
***************
*** 4004,4024 ****
     struct restore_selected_frame_args *fr =
     (struct restore_selected_frame_args *) args;
     struct frame_info *frame;
     int level = fr->level;

!   frame = find_relative_frame (get_current_frame (), &level);

     /* If inf_status->selected_frame_address is NULL, there was no
        previously selected frame.  */
!   if (frame == NULL ||
!   /*  FRAME_FP (frame) != fr->frame_address || */
!   /* elz: deleted this check as a quick fix to the problem that
!      for function called by hand gdb creates no internal frame
!      structure and the real stack and gdb's idea of stack are
!      different if nested calls by hands are made.
!
!      mvs: this worries me.  */
!       level != 0)
       {
         warning ("Unable to restore previously selected frame.\n");
         return 0;
--- 4004,4017 ----
     struct restore_selected_frame_args *fr =
     (struct restore_selected_frame_args *) args;
     struct frame_info *frame;
+   CORE_ADDR frame_address = fr->frame_address;
     int level = fr->level;

!   frame = find_frame_addr_in_frame_chain (frame_address);

     /* If inf_status->selected_frame_address is NULL, there was no
        previously selected frame.  */
!   if (frame == NULL)
       {
         warning ("Unable to restore previously selected frame.\n");
         return 0;

--
Jim Ingham                                   jingham@apple.com
Developer Tools - gdb
Apple Computer


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-04-16 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-03 15:50 infrun.c:restore_selected_frame??? Jim Ingham
2002-04-08 16:26 ` infrun.c:restore_selected_frame??? Andrew Cagney
2002-04-09 13:18   ` infrun.c:restore_selected_frame??? Jim Ingham
2002-04-09 14:25     ` infrun.c:restore_selected_frame??? Andrew Cagney
2002-04-16  8:02       ` infrun.c:restore_selected_frame??? Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox