Deferred recording

By default, UDB starts recording execution history as soon as it attaches to or launches the program being debugged. Recording is necessary for Time Travel Debugging, and hence this is usually desirable behaviour.

However, the program runs more slowly in record mode, so if it takes a long time to set up the conditions of the defect under investigation, it can make sense to start in deferred-recording mode, get the program into a suitable state, and then turn on recording using the urecord command.

Starting UDB with recording disabled

To disable recording, use the udb --defer-recording command-line option, or set UNDO_defer_recording=true in the environment. The effect is that reverse-execution commands and time-travel commands are disabled until recording is enabled using the urecord command. For example:

$ udb --defer-recording examples/hashtable
Reading symbols from examples/hashtable...
not running> tbreak table_remove
Temporary breakpoint 1 at 0x13b0: file hashtable.c, line 98.
not running> run
Starting program: examples/hashtable

Temporary breakpoint 1, table_remove (table=0x5555555592a0, element=4675) at hashtable.c:98
98          if (_table_find(&i, table, element))
not recording> urecord

No more reverse-execution history.
Have reached start of recorded history.
table_remove (table=0x5555555592a0, element=4675) at hashtable.c:98
98          if (_table_find(&i, table, element))
[Switching to Thread 3204785.3204785]
recording 1> continue
Continuing.

Program received signal SIGSTOP, Stopped (signal).

The program has exited, but is still being debugged.
You can use UDB reverse commands to go backwards; see "help udb" for details.

__GI__exit (status=status@entry=0) at ../sysdeps/unix/sysv/linux/_exit.c:31
31      ../sysdeps/unix/sysv/linux/_exit.c: No such file or directory.
end 2,107,211> reverse-continue
Continuing.

No more reverse-execution history.
Have reached start of recorded history.
table_remove (table=0x5555555592a0, element=4675) at hashtable.c:98
98          if (_table_find(&i, table, element))

Note

The tbreak command sets a temporary breakpoint, one which is automatically deleted as soon as it has been hit.

urecord [continue]

Switch from deferred recording to full Time Travel Debugging.

Begin recording execution history so that it can be subsequently replayed. The continue argument automatically continues the program.

To begin recording when a breakpoint is hit, combine this with commands, for example:

not recording> info execution-mode
UDB is in deferred-recording mode (use the 'urecord' command to enable recording).
not recording> tbreak table_remove
Temporary breakpoint 2 at 0x5555555553b0: file hashtable.c, line 98.
not recording> commands 2
Type commands for breakpoint(s) 2, one per line.
End with a line saying just "end".
>urecord continue
>end
not recording> continue
Continuing.

Temporary breakpoint 2, table_remove (table=0x5555555592a0, element=763) at hashtable.c:98
98          if (_table_find(&i, table, element))
hashtable: hashtable.c:131: main: Assertion `table_contains(table, element)' failed.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.