From bd2185c23d2f79de2ce478d2ab6a30af52748d25 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Wed, 14 Feb 2024 20:13:49 -0500 Subject: Configuring lldb dap integration --- .config/nvim/init.vim | 5 +++++ .config/nvim/lua/dap_lldb.lua | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .config/nvim/lua/dap_lldb.lua (limited to '.config/nvim') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index cbca761..3503890 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -66,6 +66,9 @@ Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.x' } Plug 'ThePrimeagen/harpoon', { 'branch': 'harpoon2' } Plug 'neovim/nvim-lspconfig' +Plug 'mfussenegger/nvim-dap' +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} +Plug 'theHamsta/nvim-dap-virtual-text' call plug#end() let g:coc_global_extensions = [ @@ -82,6 +85,8 @@ let g:coc_global_extensions = [ lua vim.g.coq_settings = {auto_start = 'shut-up',} +lua require("dap_lldb") + " Goyo plugin makes text more readable when writing prose: map f :Goyo \| set linebreak diff --git a/.config/nvim/lua/dap_lldb.lua b/.config/nvim/lua/dap_lldb.lua new file mode 100644 index 0000000..495fb72 --- /dev/null +++ b/.config/nvim/lua/dap_lldb.lua @@ -0,0 +1,37 @@ +local dap = require('dap') +dap.adapters.lldb = { + type = 'executable', + command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path + name = 'lldb' +} + +local dap = require('dap') +dap.configurations.c = { + { + name = 'Launch', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', '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, + }, +} + +dap.configurations.cpp = dap.configurations.c +require("nvim-dap-virtual-text").setup() -- cgit v1.2.3