okay dbg with c

This commit is contained in:
Christoph J. Scherr 2024-02-05 16:25:00 +01:00
parent 27a96fe230
commit 6b14039e40
3 changed files with 119 additions and 9 deletions

View File

@ -10,7 +10,7 @@ local servers = {
"tsserver",
"clangd",
"pyright",
"rust_analyzer",
-- "rust_analyzer",
"bashls",
"cmake",
}

View File

@ -587,6 +587,58 @@ M.debug = {
"debug open repl",
noremap = true,
},
["<leader>dws"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.scopes)
my_sidebar.open()
end,
"debug window scopes",
noremap = true,
},
["<leader>dwt"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.threads)
my_sidebar.open()
end,
"debug window threads",
noremap = true,
},
["<leader>dwe"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.expression)
my_sidebar.open()
end,
"debug window expressions",
noremap = true,
},
["<leader>dwi"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.sessions)
my_sidebar.open()
end,
"debug window sessions",
noremap = true,
},
["<leader>dwf"] = {
function()
local widgets = require "dap.ui.widgets"
local my_sidebar = widgets.sidebar(widgets.frames)
my_sidebar.open()
end,
"debug window scopes",
noremap = true,
},
["<leader>dK"] = {
function()
require('dap.ui.widgets').hover()
end,
"debug hover",
noremap = true,
},
},
}

View File

@ -729,17 +729,18 @@ local plugins = {
},
{
"mfussenegger/nvim-dap",
lazy = false,
init = function()
require("core.utils").load_mappings "debug"
end,
config = function()
local dap = require "dap"
dap.adapters.gdb = {
type = "executable",
command = "gdb",
args = { "-i", "dap" }, -- NOTE: gdb sometimes has no built in dap interface, LMDE6 has this i
-- think. Don't bother with compiling from source
}
-- dap.adapters.gdb = {
-- type = "executable",
-- command = "gdb",
-- args = { "-i", "dap" }, -- NOTE: gdb sometimes has no built in dap interface, LMDE6 has this i
-- -- think. Don't bother with compiling from source
-- }
dap.adapters.codelldb = {
type = "server",
port = "${port}",
@ -747,11 +748,11 @@ local plugins = {
-- CHANGE THIS to your path!
command = "/home/plex/.local/share/codelldb/extension/adapter/codelldb",
args = { "--port", "${port}" },
-- On windows you may have to uncomment this:
-- detached = false,
},
}
dap.configurations.cpp = {
{
name = "Launch file",
@ -764,8 +765,65 @@ local plugins = {
stopOnEntry = false,
},
}
dap.configurations.rust = dap.configurations.cpp
dap.configurations.c = dap.configurations.cpp
-- dap.configurations.rust = dap.configurations.cpp
end,
},
{
"rcarriga/nvim-dap-ui",
enabled = false,
lazy = false,
dependencies = {
"mfussenegger/nvim-dap",
},
config = function()
local dap, dapui = require "dap", require "dapui"
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.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
require("neodev").setup {
library = { plugins = { "nvim-dap-ui" }, types = true },
}
end,
},
{ "folke/neodev.nvim", opts = {} },
{
"mrcjkb/rustaceanvim",
version = "^4", -- Recommended
ft = { "rust" },
config = function()
vim.g.rustaceanvim = function()
-- Update this path
local extension_path = vim.env.HOME .. ".local/share/codelldb"
local codelldb_path = extension_path .. "adapter/codelldb"
local liblldb_path = extension_path .. "lldb/lib/liblldb"
local this_os = vim.uv.os_uname().sysname
-- The path is different on Windows
if this_os:find "Windows" then
codelldb_path = extension_path .. "adapter\\codelldb.exe"
liblldb_path = extension_path .. "lldb\\bin\\liblldb.dll"
else
-- The liblldb extension is .so for Linux and .dylib for MacOS
liblldb_path = liblldb_path .. (this_os == "Linux" and ".so" or ".dylib")
end
local cfg = require "rustaceanvim.config"
return {
dap = {
adapter = cfg.get_codelldb_adapter(codelldb_path, liblldb_path),
},
}
end
end,
},
}