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
- Run an executable on target system under gdbserver. For example, you can use the built-in terminal to access the remote host:
- Launch the GDB remote Run/Debug configuration in CLion.
Configuring remote GDB debug on macOS local hostBundled 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-gnuflag. To deploy the GDB compiled in such a way, do the following:
- Download the binutils-gdb sources from the Git-repository.
Switch branch to
Build using the following command sequence:
./configure --target=x86_64-linux-gnu --with-python --prefix=<install_dir>. make make install
- Select this debugger in the remote Run/Debug configuration.