Re: [discuss] Support for reverse-execution

Dan Shearer
2005-05-19T01:23:10Z

Johan Rydberg, a developer at Virtutech, has got some patches against
6.3 (for discussion only) that he'll be sending along to this list. I
want to bring up bookmarks for discussion, a topic that isn't yet
addressed by his patches.

First, what is addressed: Johan has implemented the reverse instructions
rstep, rstepi, rnext and rnexti for PowerPC, Sparc and Sparc64 targets.
Next to appear will be rcontinue (easy) and rfinish (not so easy),
however all of these are obvious reversible analogues to the
conventional commands. You should see these when Sweden wakes up next.

Bookmarks are not about reversibility, they are about checkpointing.

To understand bookmarks you first have to think about what a reversible
target is. Any simulator (or real hardware for that matter) capable of
reversibility has a mechanism to keep or re-generate all system state
and the ability to restart execution from any point in that stored
state. Bookmarking is a way of exposing this functionality to the user.

Imagine two new gdb commands, get-bookmark and goto-bookmark.
get-bookmark asks the simulator for a token which uniquely identifies
the current state of the system. goto-bookmark gives a token back to the
simulator and asks the simulator to load system state as it was at the
time of the bookmark. The token is an arbitary number that makes sense
to the particular simulator. Some might count in clock cycles, others in
milliseconds or maybe the number of the checkpoint that corresponds to
the state at that time. All gdb knows about is the value of the
bookmark.

This gives a gdb user the capability to explore alternative futures
without a complicated interface. A sequence might be get-bookmark,
change a value, run for ten seconds. Break, goto-bookmark, try another
value and run for ten seconds. Like an infinite rewind-replay facility,
very helpful when part of the pain is getting the circumstances just
right for the bug to appear.

It would be an interesting discussion to see how bookmarks could be
incorporated into the gdb framework.

--
Dan Shearer
dan@shearer.org