# GoLand¶

GoLand is a Go IDE from JetBrains, available from the JetBrains website.

GoLand uses the Delve debugger internally to support reverse debugging. Programs can either be recorded and replayed directly within GoLand or recordings from Undo’s Live Recorder can be loaded.

## Enabling UndoDB within GoLand¶

At present there is no built in configuration in GoLand to allow selection of UndoDB. To use UndoDB in GoLand:

1. Fetch and install the version of Delve with Undo support

This needs to replace the dlv binary in your GoLand tree. The UndoDB release ships with a script to do this, called patch-goland-delve. This must be called as:

patch-goland-delve <goland-base-path>

<goland-base-path> should be the path to your GoLand installation. It will save the original version of Delve to dlv.orig. Running patch-goland-delve -u <goland-base-path> will restore this original binary.

2. Launch GoLand with an additional environment variable

To allow GoLand to select the UndoDB backend for recording and replaying, the environment variable DLV_RECORD_REPLAY_BACKEND must 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:

DLV_RECORD_REPLAY_BACKEND=undo bin/goland.sh

## Using UndoDB within GoLand¶

GoLand integrates with UndoDB 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 reverse debug 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 file from Live Recorder.

To run in Record and Debug mode use the Run -> Record and Debug menu option or the button.