Re: [discuss] Support for reverse-execution

Michael Snyder
2005-05-20T21:11:44Z

In regards to the question "where does a reverse-step put you?"
(ie. at the beginning of a line, or somewhere in the line):

> Sorry, I'm confused. Isn't it right that if I'm stepping
> backwards through code such as this:
>
> i += 1;
> foo (i);
> =>i = 0;
>
> where "=>" shows the current source line, then typing `rnext'
> once will get me to this:
>
> i += 1;
> =>foo (i);
> i = 0;
>
> which means I'm now before the CALL insn that calls `foo'?

I agree with this interpretation. If I am a user (and I am),
and I were to say:
(gdb) step
(gdb) reverse-step (or whatever)
I would expect to be back where I started, ie. at the
*beginning* of the original line.

Dan J. has said that we might need to reverse-stepi until
we've gone back one too many, and then do a forward step.
I agree. In fact, I think it will be necessary to do
the following:

(gdb) reverse-step
# reverse-stepi once (or until we leave the *current* line)
# now establish the step-range start and end (prev line)
# reverse-stepi until we leave the prev line
# stepi once to get back to the desired line.