Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Ingham <jingham@apple.com>
To: gdb-patches@sources.redhat.com
Subject: infrun.c:restore_selected_frame???
Date: Wed, 03 Apr 2002 15:50:00 -0000	[thread overview]
Message-ID: <9637D4C6-475D-11D6-A9CC-000393540DDC@apple.com> (raw)

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


             reply	other threads:[~2002-04-03 23:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-03 15:50 Jim Ingham [this message]
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

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=9637D4C6-475D-11D6-A9CC-000393540DDC@apple.com \
    --to=jingham@apple.com \
    --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