diff --git a/lua/setup/my_dap.lua b/lua/setup/my_dap.lua index 6318265..a031857 100644 --- a/lua/setup/my_dap.lua +++ b/lua/setup/my_dap.lua @@ -95,19 +95,52 @@ dap.adapters.codelldb = { } } +dap.adapters.lldb = { + type = 'executable', + command = os.getenv('SCOOP') .. '/apps/llvm/current/bin/lldb-vscode.exe', + name = 'lldb' +} + dap.configurations.cpp = { { - name = "Launch file", + name = "Launch codelldb", type = "codelldb", request = "launch", program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build_nvim/', 'file') end, cwd = '${workspaceFolder}', stopOnEntry = true, }, } +dap.configurations.cpp = { + { + name = 'Launch lldb', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build_nvim', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + + -- 💀 + -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: + -- + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + -- + -- Otherwise you might get the following error: + -- + -- Error on launch: Failed to attach to the target process + -- + -- But you should be aware of the implications: + -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html + -- runInTerminal = false, + }, +} + -- EXTENSIONS require("nvim-dap-virtual-text").setup()