2023-03-13 20:43:34 +00:00
|
|
|
vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end)
|
2023-03-16 20:13:34 +00:00
|
|
|
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
|
2023-03-15 22:17:00 +00:00
|
|
|
vim.keymap.set('n', '<F10>', function() require('dap').step_over() end)
|
|
|
|
vim.keymap.set('n', '<F11>', function() require('dap').step_into() end)
|
|
|
|
vim.keymap.set('n', '<F12>', function() require('dap').step_out() end)
|
2023-03-13 19:58:45 +00:00
|
|
|
|
2023-03-13 20:43:34 +00:00
|
|
|
require('dap').adapters.lldb = {
|
|
|
|
type = 'executable',
|
|
|
|
command = '/usr/bin/lldb-vscode', -- adjust as needed
|
|
|
|
name = 'lldb',
|
2023-03-13 19:58:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
local lldb = {
|
2023-03-13 20:43:34 +00:00
|
|
|
name = 'Launch lldb',
|
|
|
|
type = 'lldb', -- matches the adapter
|
|
|
|
request = 'launch', -- could also attach to a currently running process
|
2023-03-13 19:58:45 +00:00
|
|
|
program = function()
|
|
|
|
return vim.fn.input(
|
2023-03-13 20:43:34 +00:00
|
|
|
'Path to executable: ',
|
2023-03-14 23:14:53 +00:00
|
|
|
vim.fn.getcwd() .. '/target/debug/',
|
2023-03-13 20:43:34 +00:00
|
|
|
'file'
|
2023-03-13 19:58:45 +00:00
|
|
|
)
|
|
|
|
end,
|
2023-03-13 20:43:34 +00:00
|
|
|
cwd = '${workspaceFolder}',
|
2023-03-13 19:58:45 +00:00
|
|
|
stopOnEntry = false,
|
|
|
|
args = {},
|
|
|
|
runInTerminal = false,
|
|
|
|
}
|
|
|
|
|
|
|
|
require('dap').configurations.rust = {
|
|
|
|
lldb -- different debuggers or more configurations can be used here
|
2023-03-14 23:30:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-14 23:36:47 +00:00
|
|
|
require("dapui").setup()
|
|
|
|
local dap, dapui = require("dap"), require("dapui")
|
|
|
|
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
|