Hi,
We are trying to find a way to do reverse execution happen with QEMU.
Actually, it is possible to debug the guest through the gdbstub, we want to
make the reverse execution possible with GDB as well.
How we are trying to make that working (basically without optimisation):
-QEMU takes regular snapshot of the VM:
that can be done with the save vm code without optimisation first.
-When the VM is stopped and GDB requests a reverse-step:
load the last snapshot and replay to one instruction before the
current PC.
There are one issue with that for now (for a basic running reverse
execution):
-How to stop one instruction before the actual PC.
We though that using "-icount" and stop the guest a little time before the
actual position would give us the right behavior (We use a qemu_timer with
vm_clock to stop the vm at the good time), but it seems that it is not
deterministic, and not reproducable.
Is that normal?
We don't make any input during the replay, and we though that it can be
caused
by some timer interruption but "-icount" is using a virtual timer as I
understand?
We have two other ideas:
-Using TCI and count each instruction executed by the processor,
then stop
one instruction before the actual position. This seems slower.
-Using single-step to count each instruction, then stop one instruction
before the actual position.
Would that be better?
For now we can restore the VM from the last snapshot, when we do a
reverse-step
but we can't stop at the exact position.
Thanks,
Fred