Re: reverse for GDB/MI

Michael Snyder
2008-12-19T19:11:37Z

Tomas Holmberg wrote:
> Vladimir Prus wrote:
>> Tomas Holmberg wrote:
>>
>>>> I am not quite sure about adding new set of commands for that. Can we use
>>>> --reverse option, thereby not introducing new commands?
>>> Adding a reverse option to the existing commands is possible. But I do
>>> not think it is a good idea. It is not always obvious what should
>>> happen when running a standard command in reverse.
>> Why? -exec-step always steps forward. -exec-step --reverse always steps
>> backward. Seems like a fairly simple model to me.
>
> There are other reverse commands than the -exec-reverse-step that are more
> complicated. If you consider all reverse commands to be simple variants
> of the forward commands, then you are correct that there should just
> be a --reverse option. But I consider them to not be simple variants.

They're not simple variants. Some of them have to deal with
issues like prologues vs. epilogues, stepping thru a return
back to the callee, etc.

It's mostly handled in infrun and infcmd, by checking the
"exec-direction" flag.

> You can also look at the documentation to see if the reverse commands are
> just variants of the forward variants. I do not think we can replace the
> documentation for reverse-step, reverse-step-instruction, reverse-continue,
> reverse-finish, reverse-next, and reverse-next-instruction and just say it
> is the reverse variant for the corresponding forward commands. Please look
> at the other reverse commands and see if you can say "reverse-finish" is
> just the reverse variant of finish.

Yeah -- it's not. ;-)
It's an analogue, that's all.