# Debug Adapter Protocol

> **TL;DR**
> OS: macOS, Linux, Windows.
>
>
>
> Connection type: `stdin`/`stdout` or TCP.
>
>
>
> Toolchains: Local only. WSL, Remote, and Docker are not supported.

Besides LLDB and GDB, CLion can work with third-party debuggers that support the [Debug Adapter Protocol (DAP)](https://microsoft.github.io/debug-adapter-protocol//specification.html). The DAP technology enables CLion to interact with various debugger implementations through a standardized interface. Ultimately, CLion’s DAP support provides a consistent debugging experience when using a new, non-LLDB/GDB debugger that supports this protocol.

> **Tip:**
> This feature is not related to CMSIS-DAP. To work with CMSIS-DAP, use [OpenOCD](openocd-support.html). Although we do not currently have a specific OpenOCD debug server, you can try using a [generic](debug-servers.html#gdb-debug-server) one or an OpenOCD run configuration instead.

Procedure: Configure a DAP debugger

1. Go to `Settings | Build, Execution, Deployment | Debugger | Debug Profiles` and then click + to add a new DAP profile or the corresponding icon in the `General-purpose debuggers` section.

![Adding a DAP debug profile from the Add Profile popup, with DAP listed first and in the general-purpose debuggers section](https://resources.jetbrains.com/help/img/idea/2026.2/cl_dap_add.png)

2. Specify your DAP debugger’s name, path to the executable, arguments, and other parameters. Then, click Apply.

![Adding a path to the DAP debugger executable](https://resources.jetbrains.com/help/img/idea/2026.2/cl_dap_add_configure.png)

You can choose between communication over standard input/output (`stdin`/`stdout`) or over TCP. If `TCP` is selected, you need to specify a port to connect to.

Keep the following in mind when configuring a DAP debugger:

* You can use the `$DebuggerPort$` macro in different fields, such as DAP executable command-line arguments or `Launch`/`Attach parameters`, to insert the TCP port number specified in the `Port` field.

* When you attach to a running process, the IDE always sends the `Attach` request. When you run a program with the debugger by clicking the ![](https://resources.jetbrains.com/help/img/idea/2026.2/app.actions.startDebugger.png) icon in the toolbar, the IDE sends the `Launch` request. Most DAP debuggers expect the `Launch` request to start a debug session with the given executable. However, if your debugger requires the `Attach` request instead, you can configure the IDE to send it when starting a debug session.

* The `Launch parameters` and `Attach parameters` are debugger-specific. CLion prefills them with sensible defaults that work for both GDB and LLDB. However, we recommend consulting the documentation for your specific debugger to determine which JSON parameters to use. CLion currently supports the `$Executable$`, `$WorkingDir$`, `$Arguments$`, `$Environment$`, and `$EnvironmentArray$` macros in `Launch parameters` and the `$Pid$` macro in `Attach parameters`. Code completion works for available macros and shows their meanings.

3. On the main toolbar, select your DAP debugger.

![Selecting the DAP debugger in a toolchain](https://resources.jetbrains.com/help/img/idea/2026.2/cl_dap_toolbar.png)

You can now perform standard [debugger actions](starting-the-debugger-session.html).

## Troubleshoot a DAP debugger

If a DAP debugger does not start or behaves unexpectedly, enable [debugger logging](configuring-debugger-options.html#enable-debugger-logging) and reproduce the problem. With the `com.jetbrains.cidr.execution.debugger` category turned on, `idea.log` records every DAP request, response, and event exchanged with the adapter. In the log, these entries appear as `FINE - #c.j.c.e.debugger`, with outgoing messages prefixed `out:` and incoming messages `in:`:

```
2026-08-18 15:21:12,358 [1154106]   FINE - #c.j.c.e.debugger - out: {
  "type": "request",
  "command": "initialize",
  ...
}
2026-08-18 15:21:12,643 [1154391]   FINE - #c.j.c.e.debugger - in: {
  "type": "response",
  "command": "initialize",
  "success": true,
  ...
}
2026-08-18 15:21:12,659 [1154407]   FINE - #c.j.c.e.debugger - out: {
  "type": "request",
  "command": "launch",
  ...
}
2026-08-18 15:21:12,726 [1154474]   FINE - #c.j.c.e.debugger - in: {
  "type": "response",
  "command": "launch",
  "success": true
}
2026-08-18 15:21:12,726 [1154474]   FINE - #c.j.c.e.debugger - in: {
  "type": "event",
  "event": "initialized"
}
```

When the adapter cannot be launched or connected to, CLion reports the Failed to initialize DAP server error in the IDE. The reason is in the traffic: compare it with a successful start, which contains a response to `initialize`, a response to `launch` or `attach`, the `initialized` event, and a response to `configurationDone`. The step that is missing or reports `"success": false` is where the handshake broke down.

## See also

### Concepts

[Debug profiles](debug-profiles.html) [Debug servers](debug-servers.html)

