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.
$ udb --defer-recording examples/hashtable Reading symbols from examples/hashtable... not running> tbreak table_remove Temporary breakpoint 1 at 0x1468: file hashtable.c, line 98. not running> run Starting program: examples/hashtable Temporary breakpoint 1, table_remove (table=0x5555555592a0, element=7718) at hashtable.c:98 98 if (_table_find(&i, table, element)) not recording> urecord Have reached start of recorded history. table_remove (table=0x5555555592a0, element=7718) at hashtable.c:98 98 if (_table_find(&i, table, element)) 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,028,907> reverse-continue Continuing. Have reached start of recorded history. table_remove (table=0x5555555592a0, element=7718) at hashtable.c:98 98 if (_table_find(&i, table, element))
The tbreak command sets a temporary breakpoint, one which is automatically deleted as soon as it has been hit.
Switch from deferred recording to full time travel debugging.
Begin recording execution history so that it can be subsequently replayed. The
continueargument 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 0x555555555468: 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.