Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: gdb@sources.redhat.com
Subject: think-o: frame.c:find_saved_register() frame1 = get_prev_frame (frame1) backwards?
Date: Tue, 12 Feb 2002 11:46:00 -0000	[thread overview]
Message-ID: <3C697103.5060908@cygnus.com> (raw)

Hello,

The function frame.c:find_saved_register() contains the code:

   /* Note that this next routine assumes that registers used in
      frame x will be saved only in the frame that x calls and
      frames interior to it.  This is not true on the sparc, but the
      above macro takes care of it, so we should be all right. */
   while (1)
     {
       QUIT;
       frame1 = get_prev_frame (frame1);
       if (frame1 == 0 || frame1 == frame)
	break;
       FRAME_INIT_SAVED_REGS (frame1);
       if (frame1->saved_regs[regnum])
	addr = frame1->saved_regs[regnum];
     }

(it dates back to prior to Red Hats CVS repository).  I think this is 
going the wrong way, looking in frame.h the doco indicates:

     /* Pointers to the next (down, inner) and previous (up, outer)
        frame_info's in the frame cache.  */
     struct frame_info *next; /* down, inner */
     struct frame_info *prev; /* up, outer */

and blockframe.c:get_prev_frame() returns the next ``up, outer'':

   /* If we have the prev one, return it */
   if (next_frame->prev)
     return next_frame->prev;

Given:

	a() { b (); }

then it is b() that is saving registers used by a().  And b() is ``down, 
inner''.

confused,
Andrew


             reply	other threads:[~2002-02-12 19:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-12 11:46 Andrew Cagney [this message]
2002-02-15 14:51 ` Kevin Buettner
2002-02-15 14:54   ` Daniel Jacobowitz
2002-02-15 18:40     ` 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=3C697103.5060908@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb@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