CLion 2017.1 Help

Remote Debug

Basics

CLion supports remote debug with GDB/gdbserver. That means that having executable running on one machine under gdbserver, you can connect to it with the GDB from CLion from another machine 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.

Remote GDB debug

Note, that you need to create a Remote GDB Run/Debug configuration before starting the debug session.

/help/img/idea/2017.1/cl_remoteConfig.png

To launch the remote GDB debug session, do the following:

  1. Run an executable on target system under gdbserver. For example, you can use the built-in terminal to access the remote host:
    /help/img/idea/2017.1/cl_remoteTerminal.png
  2. Launch the GDB remote Run/Debug configuration in CLion.
    /help/img/idea/2017.1/cl_remoteDebugWindow.png
The execution will stop on a breakpoint set from the IDE.

Configuring remote GDB debug on macOS local host

Bundled version of GDB for macOS is not applicable for debugging a Linux target. You need to use GDB version compiled with --target=x86_64-linux-gnu flag. To deploy the GDB compiled in such a way, do the following:
  1. Download the binutils-gdb sources from the Git-repository.
  2. Switch branch to gdb-7.11.1 release.
  3. Build using the following command sequence:
    ./configure --target=x86_64-linux-gnu --with-python --prefix=<install_dir>.makemake install
  4. Select this debugger in the remote Run/Debug configuration.
Note: don't set this debugger globally in the IDE in Toolchains settings. In this case the local debug on macOS won't work.
Last modified: 19 July 2017