73 lines
1.8 KiB
Lua
73 lines
1.8 KiB
Lua
local dap = require("dap")
|
|
|
|
local function pwd() return io.popen("pwd"):lines()() end
|
|
|
|
dap.adapters.cppdbg = {
|
|
id = "cppdbg",
|
|
type = "executable",
|
|
command = os.getenv("HOME") .. "/.vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7",
|
|
}
|
|
|
|
dap.adapters.netcoredbg = {
|
|
type = "executable",
|
|
command = "netcoredbg",
|
|
args = {
|
|
"--interpreter=vscode",
|
|
string.format("--engineLogging=%s/netcoredbg.engine.log", XDG_CACHE_HOME),
|
|
string.format("--log=%s/netcoredbg.log", XDG_CACHE_HOME),
|
|
},
|
|
}
|
|
|
|
dap.configurations.cpp = {
|
|
{
|
|
name = "Launch file",
|
|
type = "cppdbg",
|
|
request = "launch",
|
|
program = function()
|
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
|
end,
|
|
cwd = "${workspaceFolder}",
|
|
stopOnEntry = true,
|
|
},
|
|
{
|
|
name = "Attach to gdbserver :1234",
|
|
type = "cppdbg",
|
|
request = "launch",
|
|
MIMode = "gdb",
|
|
miDebuggerServerAddress = "localhost:1234",
|
|
miDebuggerPath = "/usr/bin/gdb",
|
|
cwd = "${workspaceFolder}",
|
|
program = function()
|
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
|
end,
|
|
},
|
|
}
|
|
dap.configurations.c = dap.configurations.cpp
|
|
dap.configurations.rust = dap.configurations.cpp
|
|
|
|
dap.configurations.cs = {
|
|
{
|
|
type = "netcoredbg",
|
|
name = "launch - netcoredbg",
|
|
request = "launch",
|
|
program = function()
|
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
|
end,
|
|
stopAtEntry = true,
|
|
},
|
|
}
|
|
|
|
local dapui = require("dapui")
|
|
dapui.setup()
|
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
|
dapui.open()
|
|
end
|
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
|
dapui.close()
|
|
end
|
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
|
dapui.close()
|
|
end
|
|
|
|
require("nvim-dap-virtual-text").setup()
|