svaante / dape

Debug Adapter Protocol for Emacs
GNU General Public License v3.0
448 stars 25 forks source link

Debug go program via tramp #109

Closed mrunhap closed 3 months ago

mrunhap commented 3 months ago

I have a remote server and config in ~/.ssh/config

Host my
    Hostname 10.60.77.125
    User     root
    Compression yes
    ControlMaster auto
    ControlPath /tmp/tramp.%C
    ControlPersist yes

When I open a remote go file and run dape, it says unable to connect

* Welcome to Dape REPL! *
Available Dape commands: debug, next, continue, pause, step, out, restart, kill, disconnect, quit
Empty input will rerun last command.

* Remote connection detected, setting prefix-local to "/ssh:my:" *
* Remote connection detected, setting host to "my" *
DAP server listening at: 127.0.0.1:56425
Unable to connect to server my:56425
> 

I already use firewalld and make this server accept all from my localhost. I also try to change config about dlv in dape-configs, host from 127.0.0.1 -> 0.0.0.0, and run dape again:

Unable to connect to server my:56610
2024-05-15T18:57:37+08:00 warning layer=rpc Listening for remote connections (connections are not authenticated nor encrypted)
> 

And I'm stuck here, any advice :) ?

svaante commented 3 months ago

Hey, If I would guess whats going on is that ports that dape is trying to connect to is not forwarded.

Unfortunately dlv does not allow for pipe connections, only TCP (AFAIK).

So what is happening here is that dape is starting dlv on the remote my machine then trying to connect from your local machine to my on port 56425.

DAP server listening at: 127.0.0.1:56425
Unable to connect to server my:56425

I would guess that port 56425 is not open to your local machine.

I would recommend you use "Local Port Forwarding":

mrunhap commented 3 months ago

Thanks for your reply, it works with port forwarding.