There are cases when you develop on one machine and run on another one. And sometimes you need to debug remotely. 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.

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:

For attaching to processes running locally on your machine but not started from the IDE, check Run | Attach to Local Process....