Go Delve

Delve is a debugger for the Go programming language. Undo has extended Delve to provide support for the UDB time travel debugger.

Undo is working with the upstream Delve community to incorporate support in the official release versions of the tool, and to extend the time travel debugging functionality. While that continues we have made available a version of Delve that supports UDB. This can be obtained using:

go install github.com/undoio/delve/cmd/dlv@undo

Using UDB within Delve

The UDB tools (udb and live-record) must be on your PATH, and the Delve command must be started with the --backend=undo option, for example:

dlv debug --backend=undo my-executable

(The dlv replay command is an exception: it automatically detects the recording file format and does not need --backend=undo.)

Within Delve, use these commands for time travel debugging:

  • rewind (alias rw) runs backwards until a breakpoint is hit or the start of recorded history is reached.

  • checkpoint (alias check) sets a checkpoint at the current position.

    • checkpoints shows the currently defined checkpoints.

    • clear-checkpoint <cp> (alias clearcheck) deletes the checkpoint <cp>.

    • restart <cp> (alias r) moves execution to checkpoint <cp>.

  • rev step (alias rev s) steps backwards to the previous source line.

  • rev step-instruction (alias rev si) steps backwards a single CPU instruction.

  • rev next (alias rev n) steps backwards to the previous source line, not counting function calls.

  • rev stepout (alias rev so) steps backwards out of the current function.

Troubleshooting

  • Problem: “Command failed: command not available” in response to a rewind or rev step-instruction command.

    Cause: Delve is using a different backend.

    Solution: Use the --backend=undo command line option to dlv.

  • Problem: “could not launch process: backend unavailable”

    Cause: The UDB tools (udb and live-record) are not on your PATH.

    Solution: Update your PATH appropriately.

  • Problem: “protocol error E03 during registers read for packet $g”

    Cause: UDB cannot find a valid license keyfile.

    Solution: Copy the keyfile to key in the same directory as the UDB tools.