tried to do debug things

This commit is contained in:
Christoph J. Scherr 2023-09-21 15:58:30 +02:00
parent 8aa6183df7
commit 5928954cc9
6 changed files with 202 additions and 24 deletions

View File

@ -15,6 +15,8 @@ require('lazy').setup(vim.tbl_extend('keep', config.user_lazy_opts(), {
{ import = 'plex.plugins.extras.editor' },
{ import = 'plex.plugins.extras.org' },
{ import = 'plex.plugins.extras.lang.go' },
{ import = 'plex.plugins.extras.lang.cpp' },
{ import = 'plex.plugins.extras.lang.rust' },
{ import = 'plex.plugins.extras.lang.json' },
{ import = 'plex.plugins.extras.lang.python' },
{ import = 'plex.plugins.extras.lang.yaml' },

View File

@ -323,4 +323,43 @@ return {
vim.g.dsf_no_mappings = 1
end,
},
-----------------------------------------------------------------------------
{
-- TODO:
-- make debugging for C. Cpp, Rust, Python work
'mfussenegger/nvim-dap',
keys = {
{
'<leader>db',
'<cmd>lua require\'dap\'.toggle_breakpoint()<CR>',
mode = { 'n', 'x' },
desc = 'Debugging: Toggle breakpoint',
},
{
'<leader>db',
'<cmd>lua require\'dap\'.continue()<CR>',
mode = { 'n', 'x' },
desc = 'Debugging: Start or continue debug session',
},
{
'<leader>dsi',
'<cmd>lua require\'dap\'.step_into()<CR>',
mode = { 'n', 'x' },
desc = 'Debugging: Step into code',
},
{
'<leader>dso',
'<cmd>lua require\'dap\'.step_over()<CR>',
mode = { 'n', 'x' },
desc = 'Debugging: Step over code',
},
{
'<leader>dm',
'<cmd>lua require\'dap\'.repl.open()<CR>',
mode = { 'n', 'x' },
desc = 'Debugging: Menu',
},
},
},
}

View File

@ -0,0 +1,74 @@
return {
{
'mfussenegger/nvim-dap',
optional = true,
dependencies = {
'mfussenegger/nvim-dap-python',
},
-- stylua: ignore
-- keys = {
-- { '<leader>dPt', function() require('dap-python').test_method() end, desc = 'Debug Method' },
-- { '<leader>dPc', function() require('dap-python').test_class() end, desc = 'Debug Class' },
-- },
config = function()
local dap = require('dap')
dap.adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path
name = 'lldb'
}
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 = {
{
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,
},
}
end,
},
}

View File

@ -0,0 +1,42 @@
return {
{
'mfussenegger/nvim-dap',
optional = true,
dependencies = {
'mfussenegger/nvim-dap-python',
},
-- stylua: ignore
-- keys = {
-- { '<leader>dPt', function() require('dap-python').test_method() end, desc = 'Debug Method' },
-- { '<leader>dPc', function() require('dap-python').test_class() end, desc = 'Debug Class' },
-- },
config = function()
local dap = require('dap')
dap.configurations.rust = {
{
-- ... the previous config goes here ...,
initCommands = function()
-- Find out where to look for the pretty printer Python module
local rustc_sysroot = vim.fn.trim(vim.fn.system('rustc --print sysroot'))
local script_import = 'command script import "' .. rustc_sysroot .. '/lib/rustlib/etc/lldb_lookup.py"'
local commands_file = rustc_sysroot .. '/lib/rustlib/etc/lldb_commands'
local commands = {}
local file = io.open(commands_file, 'r')
if file then
for line in file:lines() do
table.insert(commands, line)
end
file:close()
end
table.insert(commands, 1, script_import)
return commands
end,
-- ...,
}
}
end,
},
}

View File

@ -125,3 +125,24 @@ Rustdoc
paragraph
rustc
Klabnik
io
rustbook
Deserialize
deserialisierbaren
SIGTERM
Beendigungsabfrage
SIGKILL
stdout
stderr
Leveln
gedroppt
#ekonstruktor
Dekonstruktor/!
dealloziiert
Dealloziierung
Dealloziieren
vvvv
TODO
vvvv
Structs
nomicon