dape
dape copied to clipboard
How to discover correct configs for debugging over TRAMP (specifically Rust)
Hi, first thank you for your work! I'm trying to set up dape
to work with Rust programs, I remember doing it successfully a few months ago, but now I need to do the same connecting to a WSL machine. Specifically:
- Host machine:
Windows 11, running Emacs
GNU Emacs 29.2 (build 2, x86_64-w64-mingw32) of 2024-02-01
- Target machine: WSL Ubuntu-22.04, with installed codelldb as shown in the README, and exposing the ssh server on port 2020.
I usually can connect via TRAMP using the path /plink:[email protected]#2020:~/
. After a bit of thinkering, I managed to customize the dape-config
to
(codelldb-rust modes
(rust-mode rust-ts-mode)
ensure dape-ensure-command command "/plink:[email protected]#2020:~/.emacs.d/debug-adapters/codelldb/extension/adapter/codelldb" command-cwd dape-command-cwd :type "lldb" :request "launch" command-args
("--port" :autoport "--settings" "{\"sourceLanguages\":[\"rust\"]}")
port :autoport :cwd "." :program
(lambda nil
(file-name-concat "target" "debug"
(thread-first
(dape-cwd)
(directory-file-name)
(file-name-split)
(last)
(car))))
:args
[]
:stopOnEntry nil)
(notice how I prefixed the command path with the TRAMP prefix). When launching dape
, I insert the string codelldb-rust command-cwd "/plink:[email protected]#2020:~/exercism/rust/luhn/target/debug/" :program "luhn"
, and I obtain the error:
* Remote connection detected, setting prefix-local to "/plink:[email protected]:" *
* Unable to connect to dap server at localhost:0 *
* Connection is configurable by host and port keys *
env: ‘/plink:[email protected]#2020:/home/abertulli/.emacs.d/debug-adapters/codelldb/extension/adapter/codelldb’: No such file or directory
so I presume dape is not correctly detecting that the server is on a remote machine. Maybe it is similar to #109 or #105 , but I don't know which port I should specify. A couple of tries:
-
codelldb-rust command-cwd "/plink:[email protected]#2020:~/exercism/rust/luhn/target/debug/" port 2020 :program "luhn"
* Remote connection detected, setting prefix-local to "/plink:[email protected]:" *
* Adapter connection shutdown without successfully initializing *
Configuration:
modes (rust-mode rust-ts-mode)
ensure dape-ensure-command
command "/plink:[email protected]#2020:~/.emacs.d/debug-adapters/codelldb/extension/adapter/codelldb"
command-cwd "/plink:[email protected]#2020:~/exercism/rust/luhn/target/debug/"
:type "lldb"
:request "launch"
command-args ("--port" "2020" "--settings" "{\"sourceLanguages\":[\"rust\"]}")
port 2020
:cwd "."
:program "luhn"
:args []
:stopOnEntry nil
prefix-local "/plink:[email protected]:"
Invalid SSH identification string.
env: ‘/plink:[email protected]#2020:/home/abertulli/.emacs.d/debug-adapters/codelldb/extension/adapter/codelldb’: No such file or directory
-
codelldb-rust command-cwd "/plink:[email protected]#2020:~/exercism/rust/luhn/target/debug/" :port 2020 :program "luhn"
* Remote connection detected, setting prefix-local to "/plink:[email protected]:" *
* Unable to connect to dap server at localhost:0 *
* Connection is configurable by host and port keys *
env: ‘/plink:[email protected]#2020:/home/abertulli/.emacs.d/debug-adapters/codelldb/extension/adapter/codelldb’: No such file or directory
So, which configuration should I change to make dape launch via TRAMP a remote debug server? In this case, everything resides on the target machine, the only thing external is Emacs. Should I do an ssh forwarding? But on which poort? Thanks!