This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/365: think-o: frame.c:find_saved_register() goes in wrong direction



>Number:         365
>Category:       gdb
>Synopsis:       think-o: frame.c:find_saved_register() goes in wrong direction
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 20 07:58:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     ac131313@redhat.com
>Release:        unknown-1.0
>Organization:
>Environment:
All except solaris.
>Description:
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

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]