Skip to content

Commit f5b687d

Browse files
committed
Add readme section about remote debugging
1 parent 32f13b1 commit f5b687d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,47 @@ It may be useful to connect to a running debug adapter node via OTP distribution
254254
}
255255
```
256256

257+
### Attaching to remote nodes
258+
259+
ElixirLS debug adapter is capable of remote debugging OTP cluster nodes. This functionality relies on OTP debugger. In order to attach to a remote node `some@host` a special launch config with request `attach` is needed. The launch config must specify `remoteNode` as well as `cookie` and `name` or `sname` for local DAP node.
260+
261+
```json
262+
{
263+
"type": "mix_task",
264+
"name": "attach",
265+
"request": "attach",
266+
"projectDir": "${workspaceRoot}",
267+
"remoteNode": "some@host",
268+
"debugAutoInterpretAllModules": false,
269+
"debugInterpretModulesPatterns": ["MyApp.*"],
270+
"env": {
271+
"ELS_ELIXIR_OPTS": "--sname elixir_ls_dap --cookie mysecret"
272+
}
273+
}
274+
```
275+
276+
#### Troubleshooting
277+
278+
- Ensure that the remote node is accessible and accepting connections
279+
- Ensure that erlang cookie is correct
280+
- Ensure that OTP `debugger` application is loadable on remote node. This may require including it in `extra_applications`
281+
- If connecting to an OTP release, ensure that it is built with `strip_beams` set to `false`. Note that it defaults to `true`
282+
- Ensure that remote node application has not been compiled with `debug_info` set to `false` via `elixirc_options` or `@compile` attribute
283+
- Ensure that both source files and compiled beams are available in the project directory
284+
285+
#### Limitations
286+
287+
Remote debugger has several limitations compared to local debugger:
288+
289+
- `dbg` macro breakpoints are not supported
290+
- conditional breakpoints, hit conditional breakpoints and log points are not supported
291+
- pausing non interpreted processes is not supported
292+
- expressions are evaluated on local node
293+
294+
#### Warning
295+
296+
ElixirLS debug adapter interprets modules with [`:int.ni/1`](https://www.erlang.org/doc/apps/debugger/int.html#ni/1) on all connected nodes. It attempts to uninterpret all modules on debug session end but that may not be possible due to loss of connectivity. This may affect production workloads. Use remote debugging with caution.
297+
257298
## Automatic builds and error reporting
258299

259300
ElixirLS provides automatic builds and error reporting. By default, builds are triggered automatically when files are saved, but you can also enable "autosave" in your IDE to trigger builds as you type. If you prefer to disable automatic builds, you can set the `elixirLS.autoBuild` configuration option to `false`.

0 commit comments

Comments
 (0)