Re: [RFA/PATCH] breakpoint.c: fix until command

Elena Zannoni
2003-01-03T17:51:01Z

Michael Elizabeth Chastain writes:
> My proposal for the behavior matrix is:
>
> until:
> continue until any source line > the current source line is reached,
> in the current stack frame, or the current stack frame pops,
> whichever comes first.
>
> until LOCATION:
> a. LOCATION is in current function: continue until $PC == LINE
> in the current stack frame, or the current stack frame pops,
> whichever comes first.
> b. LOCATION not in current function: error
>

this is essentially what it does now. But instead of erroring out it
stops at the exit from the current frame. Because we cannot reliably
distinguish a. from b. Roughly, your error is equivalent to exiting
the frame.

> In the 'until LOCATION' case, I guess it's okay for the user to be on
> line 70 and ask to continue 'until line 65'. The user is expecting
> the program to get to line 65 and they are probably right.
>

there could be a loop, and they may want to go back to the top, so yes.

> I don't want to say "for every command line, choose some behavior and
> implement it". That leads to a bunch of quirky non-orthogonal commands.
> I want to say "for everything we can imagine the user doing,
> provide one simple way to do it." In Elena's matrix:
>
> until funcname:
> d. funcname called from current frame (2) --> continue until func is reached
> e. funcname not called from current frame --> cont until current frame pops.
>
> There is already a way to do almost exactly this in gdb:
>
> tbreak funcname
> finish
>
> If we had a user-accessible 'mbreak' command for momentary breakpoints,
> then this would be identical:
>
> mbreak funcname
> finish
>
> Judging by the November thread, most people really want to have
> 'until LOCATION' always do something, even when LOCATION is not in

Yes, some people agreed it would be more convenient to have 'until' do
something different from what it does currently (back to what it did
in 4.18).

Independently of that, we all agree now that the 2 behaviors are
incompatible. So either we define another command, or leave the world
as is (but fix the doco and the testsuite).

> the current frame. I really think it should give an error
> in that case.
>
> Michael C