This is the mail archive of the gdb-patches@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]

Re: [RFC] Backtrace limit


[switched to gdb-patches]

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).

There's an extra sentinel frame to simplify the unwind code, it's never printed. If we can add at testcase then I don't think we need to be too fussed over how it's fixed (I suspect level >= 0 is more robust than != -1).


If you need help with the testcase, let me know.

Andrew

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




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