simrat39 / rust-tools.nvim

Tools for better development in rust using neovim's builtin lsp
MIT License
2.17k stars 158 forks source link

rust-tools.dap Port Configuration Not Working #304

Closed ddxtanx closed 1 year ago

ddxtanx commented 1 year ago

I'm currently trying to setup Rust debugging using the codelldb setup listed in the wiki. However, whenever I try to debug a file codelldb exits with status code 1 with the error being listed as "Couldn't connect to 127.0.0.1:${port}: ECONNREFUSED". Is this a problem with how rust-tools.dap is setup or are there configuration steps that I should do to get the port variable filled in? Thank you so much!

ddxtanx commented 1 year ago

I can confirm it is the resolution of ${port} that is making the configuration fail. Manually entering the configuration like

code_lldb_port_num = 13000

return {
  lldb = {
    type = 'server',
    executable = { 
      command = '/Users/{my name}/.vscode/extensions/vadimcn.vscode-lldb-1.8.1/adapter/codelldb',
      args = {"--port", code_lldb_port_num}-- adjust as needed, must be absolute path
    },
    name = 'lldb',
    host = '127.0.0.1',
    port = code_lldb_port_num
  }
}

makes the DAP setup work perfectly.

juhaku commented 1 year ago

@ddxtanx How did you come up with that port number 13000? Is that constant? or can anyone define whatever port one wish?

ddxtanx commented 1 year ago

@juhaku It's just a random port I chose! The only important part is that it is defined in the lua file, whereas in the rust-tools.dap file, it is defined as an unresolved "${port}".

juhaku commented 1 year ago

Awesome, I update my configs as well.

AlexSWall commented 1 year ago

I get the same issue, and resolved by manually setting the port.

simrat39 commented 1 year ago

Works for me with ${port}, might be an os thing? not sure. Anyways, manually set the port if it doesn't work for some reason

dallas1287 commented 11 months ago

Does just manually setting the port actually work on Windows? I've done the manual setting and it almost works but the debugger just rejects any breakpoints