dbg shit but does something
This commit is contained in:
parent
034587fa6c
commit
bb1e8a50cc
3
init.lua
3
init.lua
|
@ -15,8 +15,7 @@ require('lazy').setup(vim.tbl_extend('keep', config.user_lazy_opts(), {
|
||||||
{ import = 'plex.plugins.extras.editor' },
|
{ import = 'plex.plugins.extras.editor' },
|
||||||
{ import = 'plex.plugins.extras.org' },
|
{ import = 'plex.plugins.extras.org' },
|
||||||
{ import = 'plex.plugins.extras.lang.go' },
|
{ import = 'plex.plugins.extras.lang.go' },
|
||||||
{ import = 'plex.plugins.extras.lang.cpp' },
|
{ import = 'plex.plugins.extras.lang.cpp' }, -- also does C and rust
|
||||||
{ import = 'plex.plugins.extras.lang.rust' },
|
|
||||||
{ import = 'plex.plugins.extras.lang.json' },
|
{ import = 'plex.plugins.extras.lang.json' },
|
||||||
{ import = 'plex.plugins.extras.lang.python' },
|
{ import = 'plex.plugins.extras.lang.python' },
|
||||||
{ import = 'plex.plugins.extras.lang.yaml' },
|
{ import = 'plex.plugins.extras.lang.yaml' },
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
optional = true,
|
-- optional = true,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'mfussenegger/nvim-dap-python',
|
'mfussenegger/nvim-dap-python',
|
||||||
},
|
},
|
||||||
|
@ -10,65 +10,55 @@ return {
|
||||||
-- { '<leader>dPt', function() require('dap-python').test_method() end, desc = 'Debug Method' },
|
-- { '<leader>dPt', function() require('dap-python').test_method() end, desc = 'Debug Method' },
|
||||||
-- { '<leader>dPc', function() require('dap-python').test_class() end, desc = 'Debug Class' },
|
-- { '<leader>dPc', function() require('dap-python').test_class() end, desc = 'Debug Class' },
|
||||||
-- },
|
-- },
|
||||||
config = function()
|
opts = function()
|
||||||
local dap = require('dap')
|
local dap = require('dap')
|
||||||
dap.adapters.lldb = {
|
dap.adapters.cppdbg = {
|
||||||
|
id = 'cppdbg',
|
||||||
type = 'executable',
|
type = 'executable',
|
||||||
command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path
|
command = '/home/cscherr/.local/share/nvim/nvim-dap/debuggers/cpptools/extension/debugAdapters/bin/OpenDebugAD7',
|
||||||
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 = {
|
dap.configurations.cpp = {
|
||||||
{
|
{
|
||||||
name = 'Launch',
|
name = "Launch file",
|
||||||
type = 'lldb',
|
type = "cppdbg",
|
||||||
request = 'launch',
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||||
end,
|
end,
|
||||||
cwd = '${workspaceFolder}',
|
cwd = '${workspaceFolder}',
|
||||||
stopOnEntry = false,
|
stopAtEntry = true,
|
||||||
args = {},
|
setupCommands = {
|
||||||
|
{
|
||||||
|
text = '-enable-pretty-printing',
|
||||||
|
description = 'enable pretty printing',
|
||||||
|
ignoreFailures = false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = 'Attach to gdbserver :1234',
|
||||||
|
type = 'cppdbg',
|
||||||
|
request = 'launch',
|
||||||
|
MIMode = 'gdb',
|
||||||
|
miDebuggerServerAddress = 'localhost:1234',
|
||||||
|
miDebuggerPath = '/usr/bin/gdb',
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||||
|
end,
|
||||||
|
setupCommands = {
|
||||||
|
{
|
||||||
|
text = '-enable-pretty-printing',
|
||||||
|
description = 'enable pretty printing',
|
||||||
|
ignoreFailures = false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
-- 💀
|
|
||||||
-- 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.c = dap.configurations.cpp
|
||||||
|
dap.configurations.rust = dap.configurations.cpp
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
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,
|
|
||||||
},
|
|
||||||
}
|
|
Loading…
Reference in New Issue