58 lines
1.8 KiB
Lua
58 lines
1.8 KiB
Lua
return {
|
|
{
|
|
"mfussenegger/nvim-dap",
|
|
keys = { "<leader>d" },
|
|
config = function()
|
|
local dap = require("dap")
|
|
|
|
-- GDB remote adapter (connects to Renode's GDB server)
|
|
dap.adapters.gdb_remote = {
|
|
type = "executable",
|
|
command = vim.fn.executable("arm-none-eabi-gdb") == 1
|
|
and "arm-none-eabi-gdb"
|
|
or "gdb-multiarch",
|
|
args = { "-i", "dap" },
|
|
}
|
|
|
|
-- Default debug configurations for Arduino/embedded
|
|
dap.configurations.c = {
|
|
{
|
|
name = "Attach to Renode (GDB :3333)",
|
|
type = "gdb_remote",
|
|
request = "attach",
|
|
target = "localhost:3333",
|
|
cwd = "${workspaceFolder}",
|
|
program = function()
|
|
return vim.fn.input("ELF path: ", vim.fn.getcwd() .. "/build/", "file")
|
|
end,
|
|
},
|
|
}
|
|
dap.configurations.cpp = dap.configurations.c
|
|
dap.configurations.arduino = dap.configurations.c
|
|
|
|
-- Breakpoint signs
|
|
vim.fn.sign_define("DapBreakpoint", { text = "●", texthl = "DiagnosticError" })
|
|
vim.fn.sign_define("DapStopped", { text = "▶", texthl = "DiagnosticOk", linehl = "DiffAdd" })
|
|
end,
|
|
},
|
|
{
|
|
"rcarriga/nvim-dap-ui",
|
|
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
|
keys = { "<leader>du" },
|
|
config = function()
|
|
local dapui = require("dapui")
|
|
dapui.setup()
|
|
|
|
-- Auto open/close UI on debug sessions
|
|
local dap = require("dap")
|
|
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
|
|
end,
|
|
},
|
|
{
|
|
"nvim-neotest/nvim-nio",
|
|
lazy = true,
|
|
},
|
|
}
|