This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA/PATCH] breakpoint.c: fix until command
Elena Zannoni wrote:
>
> Michael Snyder writes:
> > Elena Zannoni wrote:
> > >
> > > Michael Snyder writes:
> >
> > > > If you say "until <line>", and the line is inside the current function,
> > > > you can impose the frame restriction. If the line (or address) is outside
> > > > the current function, or if you give a function name or something else,
> > > > you can't. And I don't think we can code that distinction at runtime.
> > >
> > > I think we should come up with a behavior matrix, something like:
> > >
> > > until:
> > > continue until next source line is reached. If already at the last line
> > > of current function, continue until current frame pops.
> > >
> > > until line:
> > > a. line in current function (1) --> continue until the line is reached.
> >
> > Agreed, with the qualification given.
> >
> > > b. line in function in inner frame --> continue until the line is reached.
> >
> > Agreed.
> >
> > > c. line in function not in inner frame --> continue until current frame pops.
> >
> > Agreed.
> >
> > > (1) However if current function is recursive, a. should become like
> > > b. But we want to enforce a different behavior, because we don't
> > > want to stop in the inner frame.
> >
> > I think this could be stated simply as "continue until the line
> > is reached by the current execution frame".
> >
> > > --> this is the main problem,
> > > because the condition is basically impossible to figure out at run
> > > time.
> >
> > If we can figure it out at runtime, you would agree to it?
> >
> > > until funcname:
> > > d. funcname called from current frame (2) --> continue until func is reached
> >
> > Agreed.
> >
> > > e. funcname not called from current frame --> cont until current frame pops.
> >
> > Agreed.
> >
> > > (2) if current function is recursive and funcame == current function
> > > we want to stop at the next inner invocation of funcname
> >
> > Ow, not obvious. But since it clearly isn't specified now,
> > I suppose we could make up such a stipulation if we choose to.
> > I don't even know what the traditional behavior would be in
> > this case.
> >
> >
> > > The 'continue until current frame pops' behavior is already there. It
> > > always puts another bp_until at the caller.
> >
> > Yep.
> >
> > So AFAICT, we have only one corner case to agree upon.
> > "until factorial".
>
> yes yes yes!
Well then...
1) Use find_pc_partial_function to determine bounds and
distinguish between in-bounds and out-of-bounds locations.
2) For func_start > loc >= func_end, use a frame-relative bp.
3) For func_start == loc or loc < func_start or loc > func_end,
use a frameless bp.
4) document, document, document!
Including the recursive corner case.
Agreed, Elena?
Daniel? Michael?
Anyone else?