CLion 2016.2 EAP: Remote GDB debug
CLion 2016.2 release is just around the corner, and today we have a EAP build (162.1236.1) for you with a long-awaited feature: Remote GDB debug!
To try it download the build from our confluence page, or get a patch-update right in the IDE in case you are using previous EAP build.
Remote GDB debug
This build brings you one of the most voted feature – remote debug. To be precise, CLion now supports remote debug with GDB/gdbserver. That means that having executable running on one host under gdbserver, you can connect to it with the GDB from CLion from another host and inspect the code using all the benefits of CLion’s debugger UI: set breakpoints from the IDE, view variable values, evaluate expressions and more.
Since GDB/gdbserver is a universal tool, many combinations are possible, from which most popular are debugging on various Linux targets from Linux/macOS hosts. On Windows remote debug is supported from version 2016.3.
To connect remotely with GDB to the target host, create GDB Remote Debug configuration (go to Run | Edit Configurations and create it from the template) and provide settings for the remote connection, like GDB to use, medium to carry the debugging packets (serial line, or an IP network using TCP or UDP), debug symbols, sysroot, path mappings:
Finally, simply run the executable on a target system under gdbserver (you can use built-in terminal to access the remote host). And start debugging the GDB remote debug configuration in CLion. The execution will stop on a breakpoints set from the IDE. You’ll be able to view variables, evaluate expressions, set values on the fly, check inline variable views in the editor and more:
Limitations and known issues
In case you’d like to debug Linux target from macOS host, you have to use GDB version compiled with
--target=x86_64-linux-gnu flag. Get the binutils-gdb sources from the Git repository, switch branch to gdb-7.11.1-release and build like this:
./configure --target=x86_64-linux-gnu --with-python --prefix=
make make install
Then select this debugger in the remote GDB configuration.
Be aware, that in case you set this debugger to be used globally in the IDE (in Build, Execution, Deployment | Toolchains settings) local debug on macOS won’t work, so we don’t recommend you doing so.
Besides note, that in case you have sources with symlinks on your host, to make remote debug work open project in CLion using the canonical paths (CPP-7052). Another problem could happen from time to time if you have another target configured in the ‘Before Run’ section of the configuration (CPP-7171).
Please, check the new functionality in case you are interested in remote debug, and provide the feedback to us in the comment section below or in our tracker. Note, that we already have some plans about UI improvements: CPP-7011, CPP-7050.
Environment variables in CMake
Our users asked us to define a way to automatically detect that CLion is used to run the CMake command on the project. After some discussion we’ve decided to introduce special environment variable (CLION_IDE) and implement environment variables completion in CMake to make it easier for you to find it:
This way now you can detect CLion usage and if so, set special variables/paths or execute some additional scripts of your choice, or just add some extra logging to your CMake.
That’s it! Full list of release notes are available by the link.
Your CLion Team
The Drive to Develop