Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* think-o: frame.c:find_saved_register() frame1 = get_prev_frame (frame1) backwards?
@ 2002-02-12 11:46 Andrew Cagney
  2002-02-15 14:51 ` Kevin Buettner
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-02-12 11:46 UTC (permalink / raw)
  To: gdb

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


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-12 11:46 think-o: frame.c:find_saved_register() frame1 = get_prev_frame (frame1) backwards? Andrew Cagney
2002-02-15 14:51 ` Kevin Buettner
2002-02-15 14:54   ` Daniel Jacobowitz
2002-02-15 18:40     ` Andrew Cagney

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