Re: [discuss] Support for reverse-execution

Daniel Jacobowitz
2005-05-20T21:27:33Z

[Michael, if you get a chance, please update your address book; I'm not
@mvista.com any more.]

On Fri, May 20, 2005 at 02:11:25PM -0700, Michael Snyder wrote:
> 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:

After reading this a couple of times, I'm pretty sure you're right.
Consider:

line: foo
line2: inc $r1
cmp $r1, 64
bne line
line3: bar # $pc points here

Reverse stepi from the inc may go to the bne, but we want to stop when
reverse stepi from the inc would go to the foo instead.

We don't have a lot of opportunity to make sure we're really where we
want to be when we're going forwards. When we're going backwards,
though, we do. Let's use it!

> (gdb) reverse-step
> # reverse-stepi once (or until we leave the *current* line)

BTW, this bit is a little more complicated, because we might go to
another frame. So we might have to do some reverse-finish's stacked in
there. I think infrun will need some serious cleaning up to pull this
off.

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

--
Daniel Jacobowitz
CodeSourcery, LLC