[RFC] Backtrace limit

David Lecomber david@streamline-computing.com
Wed Aug 25 19:49:00 GMT 2004


I've just filed a bug (1790) and done some investigation into the
backtrace limit variable.

Essentially the limiting doesn't work: set it to 10, and it always
claims to be true.  The culprit is  that the type of frame->level is
int, and the type of backtrace_limit is uint.

This wouldn't be a problem except that there is always a frame with
level -1 (it seems to be the 0 level-frame when printed out).

So, the non-elegant fix is:

RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.190
diff -c -p -r1.190 frame.c
*** frame.c     2 Aug 2004 03:36:24 -0000       1.190
--- frame.c     25 Aug 2004 19:48:30 -0000
*************** get_prev_frame (struct frame_info *this_
*** 1179,1185 ****
        return NULL;
      }

!   if (this_frame->level > backtrace_limit)
      {
        error ("Backtrace limit of %d exceeded", backtrace_limit);
      }
--- 1179,1186 ----
        return NULL;
      }

!   if (this_frame->level != -1 &&
!       (unsigned int) this_frame->level > backtrace_limit)
      {
        error ("Backtrace limit of %d exceeded", backtrace_limit);


But I'm open to suggestions involving making backtrace_limit a signed
int.

Any comments?

Cheers
David



More information about the Gdb mailing list