Remote debugging
Remote debug via gdbserver/lldb-server is especially useful for the cases when building on target is expensive or unavailable: after placing the binary on the target and launching it under gdbserver or lldb-server, you can connect to it from CLion and get the full IDE debug experience like if your program was running locally.
CLion provides two configurations for remote gdbserver/lldb-server debug, Remote GDB Server (the case of GDB only) and Remote Debug (for both GDB and LLDB).
Use Remote GDB Server if you work with a CMake project and if you want CLion to automatically build and upload the binary to the remote machine. This configuration will also launch the program under gdbserver for you, so you will not need to do that manually.
Use Remote Debug if you already have the executable and the symbol file. This configuration is independent of a particular build system or project format. Note that you will need to synchronize the files and launch your program under gdbserver/lldb-server manually.
System and IDE configuration
Remote Debug | Remote GDB Server | |
---|---|---|
Local OS | macOS / Linux / Windows for GDB; macOS / Linux for LLDB | macOS / Linux / Windows |
Remote OS | Any OS supporting gdbserver for GDB; macOS / Linux or another supporting lldb-server for LLDB | Any OS supporting gdbserver and SSH |
Connection protocol | TCP / UDP or serial line | TCP / UDP or serial line; SSH for uploading |
Required tools | gdbserver or lldb-server on target | gdbserver on target |
Sources location | Locally; symbol file also placed locally | Locally |
Synchronization | Manual | Automatic for the binary |
Building | Not specified | Locally (cross-compilation required) |
Run/Debug | Program runs remotely under gdbserver/lldb-server; CLion's GDB/LLDB connects to the running process and debugs it locally | Program runs remotely under gdbserver; CLion's GDB connects to the running process and debugs it locally |
Project-level settings
Remote Debug | Remote GDB Server | |
---|---|---|
Project format | Any | CMake |
Toolchain | Not specified | Default on macOS/Linux; MinWG, Cygwin, WSL on Windows; Remote and Docker toolchains also available |
Path mappings | Not created automatically, should be set up in run/debug configuration | Not created automatically, should be set up in run/debug configuration |