1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
local dap = require('dap')
--local home_path = vim.fn.expand('$HOME')
-- Unsafe Defaults
local mi_mode = ""
local mi_debugger_path = ""
-- Unix
if vim.loop.os_uname().sysname == 'Linux' then
mi_mode = "gdb"
mi_debugger_path = vim.trim(vim.fn.system('which gdb'))
-- MacOS
elseif vim.loop.os_uname().sysname == 'Darwin' then
mi_mode = "lldb"
mi_debugger_path = vim.trim(vim.fn.system('which lldb-mi'))
else
error("Unsupported OS")
end
--dap.adapters.cppdbg = {
-- type = "server",
-- port = "${port}",
-- executable = {
-- command = vim.fn.stdpath("data") .. '/mason/bin/dlv',
-- args = { "dap", "-l", "127.0.0.1:${port}" },
-- },
-- --command = home_path .. '/extension/debugAdapters/bin/OpenDebugAD7',
--}
-- cpp
dap.adapters.cppdbg = {
type = 'executable',
command = 'OpenDebugAD7',
id = 'cppdbg',
}
dap.configurations.cpp = {
{
name = "Launch file",
type = "cppdbg",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
--stopAtEntry = true,
--MIMode = mi_mode,
--miDebuggerPath = mi_debugger_path
}
}
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
-- javascript
dap.adapters.node2 = {
type = 'executable',
command = 'node-debug2-adapter',
args = {},
}
dap.configurations.javascript = {
{
name = 'Launch',
type = 'node2',
request = 'attach',
program = '${file}',
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = 'inspector',
console = 'integratedTerminal',
},
}
dap.adapters.python = {
type = 'executable';
command = vim.trim(vim.fn.system('which python'));
args = { '-m', 'debugpy.adapter' };
}
dap.configurations.python = {
{
-- The first three options are required by nvim-dap
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
request = 'launch';
name = "Launch file";
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
program = "${file}"; -- This configuration will launch the current file if used.
stopOnEntry = true,
},
}
|