Note
This feature is experimental and may change or be removed in the future.
CLion¶
CLion is a C/C++ IDE from JetBrains, available from the JetBrains website.
Undo supplies a plugin which integrates UDB into CLion, allowing you to interactively debug an application from within the CLion IDE.
Enabling UDB within CLion¶
Configure CLion to use UDB.
Choose File › Settings… › Build, Execution, Deployment › Toolchains.
Under Debugger choose Custom GDB executable.
If you have previously installed UDB, enter
/usr/local/bin/udb
in the text box. Otherwise, use the Browse button and navigate to the location of the udb executable.When CLion recognizes the pathname, a message will appear, e.g. “✓ Version: 10.2”.
Install the plugin.
Choose File › Settings… › Plugins.
Select the Marketplace tab, enter
udb
in the search box, press Install and restart CLion.
Using UDB within CLion¶
Starting a debug session works exactly as normal with CLion. However the debugger toolbars have some new buttons.
On the left toolbar, the Resume button is followed by a Reverse Resume button, which executes backwards from the current point until a breakpoint or watchpoint is hit, or execution is interrupted.
On the top toolbar, there are new Undo, Reverse Step Out, Reverse Step Into and Reverse Step Over buttons.
If you are familiar with other UDB commands, they can be entered at the Debug GDB tab.
Loading an Undo recording with CLion¶
CLion can also be used to replay an Undo recording, by following this procedure:
Configure CLion to use UDB, by following the procedure under Enabling UDB within CLion.
Create a “Core Dump Debug” run configuration, by selecting Run/Debug Configuration and then Core Dump Debug.
In the Debugger field, select udb.
In the Core Dump chooser, select the desired Undo recording.
Proceed to debug as if this were a live executable.
Using a Docker toolchain¶
A Docker toolchain can be used to run either a live debug session or to replay a recording.
Follow the instructions on the JetBrains website to set up the docker toolchain. Add the following to the dockerfile:
RUN mkdir -p /.local/share RUN chmod -R 0777 /.local RUN mkdir /.cache RUN chmod 0777 /.cache ADD undo-7.1.1.tgz /
where
undo-7.1.1.tgz
should be replaced by the name of your distribution download.Configure CLion to use UDB in the docker toolchain.
Choose File › Settings… › Build, Execution, Deployment › Toolchains.
Click
+ (Add)
and choose Docker (if not already present)Under Debugger choose Custom GDB executable.
Enter
/undo-7.1.1/udb
in the text box (whereundo-7.1.1
should be the top level directory of the unzipped distribution)Note: you must make the docker toolchain the default (if it is not already) by clicking on the Up button. Failure to do so can result in the message “is not a core dump: file format not recognized”.
Configure CLion to replay a recording
If you wish to replay a recording you can set the volume binding under the Toolchains setting so that the recording file on the host machine is viewable by the docker container.
Under Container Settings add a Volume binding and make the directory where the recording is stored visible to the docker container. The directory name must be the same on both sides.
The recording file can now be replayed as described in Loading an Undo recording with CLion with the exception that in the Debugger field you should select udb from ‘Docker’ toolchain.