GoLand is a Go IDE from JetBrains, available from the JetBrains website.
GoLand uses the Delve debugger internally to support time travel debugging. Programs can either be recorded and replayed directly within GoLand or recordings from LiveRecorder can be loaded.
Enabling UDB within GoLand¶
At present there is no built in configuration in GoLand to allow selection of UDB. To use UDB in GoLand:
Fetch and install the version of Delve with Undo support
This needs to replace the
dlvbinary in your GoLand tree. The UDB release ships with a script to do this, called
patch-goland-delve. This must be called as:
<goland-base-path>should be the path to your GoLand installation. It will save the original version of Delve to
patch-goland-delve -u <goland-base-path>will restore this original binary.
Launch GoLand with an additional environment variable
To allow GoLand to select the UDB backend for recording and replaying, the environment variable
DLV_RECORD_REPLAY_BACKENDmust be set to
undo. Depending on how you launch GoLand this can be achieved in various ways. If launching from a shell in the GoLand base path, run:
Using UDB within GoLand¶
GoLand integrates with UDB in two ways:
replaying existing saved recordings, with Debug Saved Trace.
recording and immediately replaying, with Record and Debug.
Note that in both modes of operation playback will start immediately. If there are no breakpoints execution will need to be paused manually.
GoLand’s time travel debugging functionality is currently limited to a “reverse continue” operation, which will run backwards until a breakpoint of some sort is hit, or we reach the beginning of the recording. To access this, use the Run -> Rewind menu option or the button.
To load an existing recording, use the menu option Run -> Debug Saved Trace…. In the current version of GoLand the user interface prompts for the Trace directory. This should not in fact be a directory, but a LiveRecorder recording file.
To run in Record and Debug mode use the Run -> Record and Debug menu option or the button.