This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
find_saved_register(frame) -> next/prev frame?
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: find_saved_register(frame) -> next/prev frame?
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 10 Jul 2000 13:26:58 +1000
Hello,
The function find_saved_register() uses:
/* 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];
}
find the frame that contains a registers value. I'm right now very
confused as I think it is looking in the wrong direction.
Consider the stack:
main()
-> outer ()
saves r1, r2
-> middle ()
saves r2, r3
-> inner()
saves r1, r3
lets assume that we've just selected the frame for middle(). I think we
should find register values at:
r1: in inner()' stack frame
r2: in the register cache
r3: in inner()'s stack frame
Looking at the above implementation. My understanding of
``get_prev_frame()'' is that it goes to the next _outer_ frame. It
should be calling get_next_frame() going to the next inner frame. It
also appears to contract the comment attatched to the code.
Can I rename get_next_frame() to get_inner_frame() and get_prev_frame()
to get_outer_frame() :-)
Andrew
PS: I should note that this code has remained largely unchanged since
'91 (which is as far back as CVS history goes!) so either something
really wierd is going on or I'm missing something obvious - I guess we
suspect the latter.