-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging support with DAP connection #505
Comments
I feel like this is something that is common enough to be a built-in feature. Though we could also go ahead and package it with Helix as a default plugin. |
Built-in seems the best. Plugins that depend on other plugins looks like not-so-cool idea. Edit: and, of course, some APIs might be available for plugins. Maybe even some generics for custom, not DAP-compliant debuggers registered by plugins. |
Yes, given that LSP is built in, DAP will be built in too. Note that both GDB and LLDB don't support DAP and implement a custom protocol, though LLDB seems to now offer a wrapper: https://github.com/llvm/llvm-project/tree/main/lldb/tools/lldb-vscode |
DAP is more common, so built in. Others might be added through wrappers and then using plugin API. Maybe GDB might be shipped as an official plugin? |
I started some development for DAP locally. Currently trying to make a transport layer. |
We should be able to reuse most of the LSP low-level code, it's the same protocol. Just the high level requests are different. |
It's not json-rpc. Currently copied lsp transport, will later isolate the common code |
Currently I already have an implementation (example for library, not in editor) that does some simple tasks:
|
Interesting, so DAP doesn't run over stdin/stdout? I think the way forward will be to define a transport and all the request/response protocol types in I took a look at emacs dap-mode today: https://emacs-lsp.github.io/dap-mode/page/gallery/ |
E.g. delve doesn't. It's a TCP/IP socket:
I'm currently tidying up the code and will push it to GitHub for us to comfortably look at it and collaborate. Stack traces work atm 🚀! |
Looks like it can be both ways. Either it's an executable we're responsible with starting and then communicating via stdio, or it's a server (that can also be externally running, we're not responsible for) and we attach to via TCP. |
Describe your feature request
Add support for setting breakpoints and running debug session, backed by DAP (debug adapter protocol). Maybe this needs to be done after WASM plugins.
DAP spec is here. The only relevant thing found on crates.io is DAP types crate. DAP should be rather simple to parse with Serde.
Neovim has nvim-dap plugin implementing this feature, VS Code has DAP built-in.
Current state: an initial implementation of DAP with some types, editor connection. To test DAP client:
go build -gcflags '-N -l' main.go
to build binary with readable variables or use:dbg source main.go
for Go.2.1.
gcc main.c -o main -O0 -g
for C program3. Start up Delve (chosen as a monolithic DAP+debugger in one binary) on port 7777:dlv dap -l 127.0.0.1:7777
3.1. Or lldb:
lldb-vscode -p 7777
tcp_process
transport will find free port and start debug adapter itself.cargo run --example dap-dlv
ordap-lldb
Editor integration works with Go, C/C++ and Rust programs at the moment.
Just enter directory containingNow you need to specify target manually, seemain.go
/main
(build output)/target/debug/rustdebug
for Rust and work with it.languages.toml
In editor I currently use example attached as a zip.
godebug.zip
TODO:
Not stdio. So,Transport
must be able to use TCP sockets and the lifecycle of debug adaptersattach
stopped
eventpause
,step
,restart
,eval
restart
supportsRestartRequest
eval
breakpoint
eventprogress*
eventsoutput
event's data can be recorded as wellis_running
)supportsTerminateRequest
eval
(after commpletions for eval are done)Middle clickRight click + Alt opens the prompt for editing conditionTried sending event into a closed channel
for eventslaunch
andattach
args, maybe some debug adapters' quirks.dlv dap
Local ``languages.toml` for Node:
Adjust path to extension in VSCode (or location where you unpacked the extension manually).
The text was updated successfully, but these errors were encountered: