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 behavior.

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 to 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 0x13bd: file hashtable.c, line 98.
not running> run 12345
Starting program: examples/hashtable 12345

Temporary breakpoint 1, table_remove (table=0x5555555592a0, element=763) at hashtable.c:98
98          if (_table_find(&i, table, element))
not recording> urecord
table_remove (table=0x5555555592a0, element=763) at hashtable.c:98
98          if (_table_find(&i, table, element))
recording 1> continue
Continuing.
hashtable: hashtable.c:131: main: Assertion `table_contains(table, element)' failed.

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6,
    no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
44      ./nptl/pthread_kill.c: No such file or directory.
recording 1,148,264> reverse-continue
Continuing.
Have reached start of recorded history.
table_remove (table=0x5555555592a0, element=763) 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 0x5555555553bd: 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.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6,
    no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
44      ./nptl/pthread_kill.c: No such file or directory.