This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
think-o: frame.c:find_saved_register() frame1 = get_prev_frame (frame1) backwards?
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: gdb at sources dot redhat dot com
- Date: Tue, 12 Feb 2002 14:46:11 -0500
- Subject: think-o: frame.c:find_saved_register() frame1 = get_prev_frame (frame1) backwards?
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