Use the clone snapshot command to revert the state of the debuggee process to that of a previously saved snapshot. By doing this, you can conveniently return to the state saved in the snapshot as opposed to rerunning the process and re-entering the debugger command sequence that brought you to that state.
Note that rerun and clone snapshot are different in that rerun always executes the process from the beginning, whereas clone snapshot does not execute the process at all; it simply duplicates the saved snapshot (using a mechanism similar to the fork system call) and behaves as though the process execution has stopped at the point when the snapshot was saved.
The clone snapshot command clones the snapshot specified by snapshot_id. If no snapshot_id is specified, the most-recently saved existing snapshot is cloned.
clone_snapshot_command
: clone snapshot [ snapshot_id ]
snapshot_id
Cloning a snapshot has two side effects:
The snapshots created after the cloned snapshot are deleted. For example, suppose four snapshots are saved from a process. Cloning the second snapshot results in the deletion of the third and fourth snapshots.
The current process is killed and replaced by the clone process. Thus, if you enter show process after cloning a snapshot, you will see that the process ID of the current process has changed to that of the cloned process. For example:
(idb) show process
>localhost:29013 (/home/user/examples/x_list) paused.
(idb) clone snapshot
Process has exited
Process 29089 cloned from Snapshot 1.
# 1 saved at 13:27:54 (PID: 29077).
stopped at [int main(void):182 0x1200023f8]
182 List<Node> nodeList;
(idb) show process
>localhost:29089 (/home/user/examples/x_list) paused.