From c65e4792a1d95862313ea91a71d3a31e83378649 Mon Sep 17 00:00:00 2001 From: Seymur Bagirov Date: Thu, 15 Feb 2024 02:47:42 +0400 Subject: [PATCH] change cpp debugger to codelldb and configure it to handle rust --- nvim/lua/themystery/plugins/dap.lua | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/nvim/lua/themystery/plugins/dap.lua b/nvim/lua/themystery/plugins/dap.lua index ad40078..c045420 100644 --- a/nvim/lua/themystery/plugins/dap.lua +++ b/nvim/lua/themystery/plugins/dap.lua @@ -24,10 +24,28 @@ return { -- c/c++ debugger local dap = require("dap") - dap.adapters.cppdbg = { - id = "cppdbg", - type="executable", - command = vim.fn.stdpath("data") .. "/mason/bin/OpenDebugAD7" + dap.adapters.codelldb = { + type = "server", + port = "${port}", + executable = { + command = vim.fn.stdpath("data") .. "/mason/bin/codelldb", + args = {"--port", "${port}"} + } + } + + dap.configurations.rust = { + { + name = "Rust Debug", + type = "codelldb", + request = "launch", + program = function() + vim.fn.jobstart("cargo build"); + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = true, + showDisassembly = false, + } }