Breakpoints can be used to request that UndoDB pauses the execution of the debuggee process when it reaches a particular position in the program. They are supported for both forwards and reverse execution.
Setting and hitting a breakpoint¶
break <location> command can be used to ask UndoDB to stop at the given
location. A location can be one of:
- A function (e.g.
- A file and line number (e.g.
- A line number in the current source file (e.g.
- A program counter value (e.g.
- The next instruction - No argument requried for this case (i.e.
See the GDB documentation for a full list of valid location values.
Once a breakpoint has been set, UndoDB will pause the debuggee whenever it reaches the location specified by the breakpoint. Here’s an example:
(udb) break main Breakpoint 1 at 0x422fd0 (udb) run Starting program: your-program Breakpoint 1, 0x0000000000422fd0 in main () (udb)
In this case the
run command has been used to start the debuggee, which will
run until it has reached the
main function. At this point we can execute
commands to analyse the state. For example:
(udb) backtrace #0 0x0000000000422fd0 in main () (udb)
We can also use
reverse-continue to move between the
breakpoint and other points in the execution of program. For example:
(udb) continue Continuing. Program received signal SIGSTOP, Stopped (signal). udb: The program has exited, but is still being debugged. udb: (You may use undodb commands to go backwards.) (udb) reverse-continue Continuing. Breakpoint 1, 0x0000000000422fd0 in main () (udb)
In this case we’ve used
continue to unpause the debuggee and run it until it
terminated. We’ve then used
reverse-continue to play the debuggee backwards
until it hits the breakpoint again.
Breakpoints can be viewed using the
info breakpoints command. For example:
(udb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000422fd0 <main> breakpoint already hit 2 times (udb)
You can delete a chosen breakpoint using
delete. For example:
(udb) delete 1 (udb) continue Continuing. Program received signal SIGSTOP, Stopped (signal). udb: The program has exited, but is still being debugged. udb: (You may use undodb commands to go backwards.) (udb) reverse-continue Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. udb: Have reached start of recorded history. (udb)
Since we deleted the breakpoint on
moves us to the beginning of recorded history. You can delete all breakpoints
delete without any arguments:
(udb) delete Delete all breakpoints? (y or n) y (udb)