Time notation¶

The Undo Engine divides the execution history of a program into BBs, units of execution consisting of deterministic operations, and in which each program counter value appears at most once.

A time in execution history is specified as a bbcount (representing the start of the BB), or as bbcount:pc (representing a PC in the BB).

Note

UDB accepts commas in the bbcount, so you can insert them to make a bbcount more readable. For example, 1,234,567 and 1234567 represent the same bbcount.

This concept of time is unrelated to wall-clock time. For example, if a program is blocked in a call to sleep(), the bbcount does not increment as no instructions are being executed.

Time commands¶

Inspect the current time using the uinfo time command, and jump to a time using the ugo time command. To help manage times, create bookmarks associating memorable names with times. To convert between time in execution history and wall-clock time, use the Log Jump feature.

uinfo time [-a]¶

The current time in execution history.

This is the number of BBs that the program has executed (the bbcount).

-a

Append the program counter value.

For example:

4% 11,310> uinfo time
Current time is: 11,310 (in recorded range: [1 - 232,759])
4% 11,310> uinfo time -a
Current time is: 11,310:0x5555555552c5 (in recorded range: [1 - 232,759])


ugo time bbcount[:pc]¶

Specify the time as bbcount to jump to the start of a BB, or as bbcount:pc to jump to a program counter value in a BB.

If bbcount is beyond the end of execution history, the program switches to record mode if necesary and continues execution until the specified bbcount is reached, or the program finishes, or a breakpoint is hit.

If the program does not reach the specified pc in the given bbcount, the time-travel operation fails.

For example:

4% 11,310> ugo time 4
50      get-dynamic-info.h: No such file or directory.
0% 4> ugo time 11,310:0x5555555552c5
71              if (i % 100 == 0)


Technical design¶

The reasons for representing time using the bbcount:pc notation are:

• Precision and unambiguity: each executed instruction in a program corresponds to a unique time in the program’s execution history.
• Performance: it’s easy to determine the bbcount and program counter, without the need for an expensive system call.
• Convenience: it’s easy to compare two times in bbcount:pc notation.
• Concision: in most cases the bbcount alone is sufficient to identify a time of interest.

Warning

There is no guarantee that different runs of a program will execute the same sequence of BBs. Non-deterministic events such as address space layout randomization, signal delivery, thread switches, and so on, may cause the execution flow to be different from run to run.