diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/plugins/dap.lua | 198 |
1 files changed, 159 insertions, 39 deletions
diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 3d7059a..03e37e5 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,57 +1,177 @@ local dap = require('dap') +dap.defaults.fallback.external_terminal = { + command = '/usr/bin/wezterm'; + args = {'-e'}; +} +--dap.adapters.lldb = { +-- type = 'executable', +-- --command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path +-- --command = '/usr/bin/vscode-lldb', -- adjust as needed, must be absolute path +-- command = 'codelldb', +-- --command = 'lldb', +-- --command = codelldb_root, +-- --command = vim.fn.stdpath("data") .. '/mason/bin/codelldb', +-- name = 'lldb', +-- host = '127.0.0.1', +-- port = 13000 +--} +-- +--local lldb = { +-- name = "Launch lldb", +-- type = "lldb", -- matches the adapter +-- request = "launch", -- could also attach to a currently running process +-- program = function() +-- return vim.fn.input( +-- "Path to executable: ", +-- vim.fn.getcwd() .. "/", +-- "file" +-- ) +-- end, +-- cwd = "${workspaceFolder}", +-- stopOnEntry = false, +-- args = {}, +-- runInTerminal = false, +-- --type = 'server', +-- port = "${port}", +-- executable = { +-- --command = vim.fn.stdpath("data") .. '/mason/bin/codelldb', +-- args = { "--port", "${port}" }, +-- } +--} +dap.adapters.cppdbg = { + id = 'cppdbg', + type = 'executable', + --command = vim.fn.stdpath('data') .. '/mason/bin/OpenDebugAD7', + command = os.getenv("HOME") .. '/apps/cpptools/extension/debugAdapters/bin/OpenDebugAD7', +} + +dap.adapters.codelldb = { + type = 'server', + port = "${port}", + executable = { + command = os.getenv("HOME") .. '/apps/codelldb/extension/adapter/codelldb', + args = {"--port", "${port}"}, + } +} + dap.adapters.lldb = { type = 'executable', - --command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path - --command = '/usr/bin/vscode-lldb', -- adjust as needed, must be absolute path - command = 'codelldb', - --command = 'lldb', - --command = codelldb_root, - name = 'lldb' + command = '/usr/bin/lldb-vscode', + name = "lldb" } --- cpp (c,c++,rust) dap.configurations.cpp = { { - name = 'Launch', - type = 'lldb', - request = 'launch', - --program = function() - -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - --end, - terminal = 'integrated', - console = 'integratedTerminal', + name = "Launch file", + type = "cppdbg", + --request = "launch", + request = "Attach", + processId = function() + return tonumber(vim.fn.input({ prompt = "Pid: "})) + end, program = function() - return vim.fn.input('program: ', vim.loop.cwd() .. '/', 'file') + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, - cwd = "${workspaceFolder}", - stopOnEntry = false, - args = {}, - }, + stopAtEntry = true, + MIMode = 'gdb', + --miDebuggerServerAddress = 'localhost:1234', + miDebuggerPath = 'gdb-oneapi', + --miDebuggerPath = '/usr/bin/gdb', + externalConsole = true, + setupCommands = { + { + text = '-enable-pretty-printing', + description = 'enable pretty printing', + ignoreFailures = false + } + }, + cwd = '${workspaceFolder}', +}, } +-- dap.adapters.cppdbg = { +-- name = 'cppdbg', +-- type = 'executable', +-- command = vim.fn.stdpath('data') .. '/mason/bin/OpenDebugAD7', +-- } +-- dap.configurations.cpp = { +-- { +-- name = 'Launch', +-- type = 'cppdbg', +-- request = 'launch', +-- --request = 'attach', +-- MIMode = 'gdb', +-- --cwd = '${workspaceFolder}', +-- -- udb='live', +-- -- miDebuggerPath = 'udb', +-- setupCommands= { +-- { +-- description= "Enable pretty-printing for gdb", +-- text= "-enable-pretty-printing", +-- ignoreFailures= true, +-- } +-- }, +-- program = '${file}', +-- cwd = vim.fn.getcwd(), +-- --attach = { +-- -- pidProperty = "processId", +-- -- pidSelect = "ask" +-- --}, +-- stopAtEntry = true, +-- --program = 'main', +-- --program = '${workspaceFolder}/main' +-- --program = '${file}', +-- --program = function() +-- -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') +-- --end, +-- }, +-- } + +--require('dap').configurations.c = { +-- lldb -- different debuggers or more configurations can be used here +--} + +-- cpp (c,c++,rust) +--dap.configurations.c = { +-- { +-- name = 'Launch', +-- type = 'lldb', +-- request = 'launch', +-- --program = function() +-- -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') +-- --end, +-- terminal = 'integrated', +-- console = 'integratedTerminal', +-- program = function() +-- return vim.fn.input('program: ', vim.loop.cwd() .. '/', 'file') +-- end, +-- cwd = "${workspaceFolder}", +-- stopOnEntry = false, +-- args = {}, +-- }, +--} -- If you want to use this for Rust and C, add something like this: dap.configurations.c = dap.configurations.cpp dap.configurations.rust = dap.configurations.cpp - -- javascript -dap.adapters.node2 = { - type = 'executable', - command = 'node-debug2-adapter', - args = {}, -} +--dap.adapters.node2 = { +-- type = 'executable', +-- command = 'node-debug2-adapter', +-- args = {}, +--} -dap.configurations.javascript = { - { - name = 'Launch', - type = 'node2', - request = 'attach', - program = '${file}', - cwd = vim.fn.getcwd(), - sourceMaps = true, - protocol = 'inspector', - console = 'integratedTerminal', - }, -} +--dap.configurations.javascript = { +-- { +-- name = 'Launch', +-- type = 'node2', +-- request = 'attach', +-- program = '${file}', +-- cwd = vim.fn.getcwd(), +-- sourceMaps = true, +-- protocol = 'inspector', +-- console = 'integratedTerminal', +-- }, +--} dap.adapters.python = { type = 'executable'; @@ -97,7 +217,7 @@ dapui.setup({ { elements = { "repl", "watches" }, size = 0.27, position = "bottom" }, }, icons = { expanded = "-", collapsed = "$" }, - controls = { enabled = false }, + --controls = { enabled = false }, floating = { border = "rounded", mappings = { close = { "q", "<esc>", "<c-o>" } } }, }) |
