Skip to content

Commit 808e6ab

Browse files
set up CPP debugger
1 parent 4e3a2f9 commit 808e6ab

File tree

2 files changed

+36
-17
lines changed

2 files changed

+36
-17
lines changed

lua/modules/lang/debugger/dap.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
-- require("modules.lang.debugger.dap_cpp")
1+
require("modules.lang.debugger.dap_cpp")
2+
--
3+
local dap = require("dap")
4+
dap.adapters.cppdbg = {
5+
id = "cppdbg",
6+
type = "executable",
7+
command = "/home/bryant/.local/share/extension/debugAdapters/bin/OpenDebugAD7",
8+
}

lua/modules/lang/debugger/dap_cpp.lua

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
local dap = require("dap")
2-
3-
dap.adapters.codelldb = {
4-
type = "server",
5-
port = "${port}",
6-
executable = {
7-
-- CHANGE THIS to your path!
8-
command = "/absolute/path/to/codelldb/extension/adapter/codelldb",
9-
args = { "--port", "${port}" },
10-
11-
-- On windows you may have to uncomment this:
12-
-- detached = false,
13-
},
14-
}
15-
162
dap.configurations.cpp = {
173
{
184
name = "Launch file",
19-
type = "codelldb",
5+
type = "cppdbg",
206
request = "launch",
217
program = function()
228
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
239
end,
2410
cwd = "${workspaceFolder}",
25-
stopOnEntry = false,
11+
stopAtEntry = true,
12+
setupCommands = {
13+
{
14+
text = "-enable-pretty-printing",
15+
description = "enable pretty printing",
16+
ignoreFailures = false,
17+
},
18+
},
19+
},
20+
{
21+
name = "Attach to gdbserver :3000",
22+
type = "cppdbg",
23+
request = "launch",
24+
MIMode = "gdb",
25+
miDebuggerServerAddress = "localhost:3000",
26+
miDebuggerPath = "/usr/bin/gdb",
27+
cwd = "${workspaceFolder}",
28+
program = function()
29+
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
30+
end,
31+
setupCommands = {
32+
{
33+
text = "-enable-pretty-printing",
34+
description = "enable pretty printing",
35+
ignoreFailures = false,
36+
},
37+
},
2638
},
2739
}

0 commit comments

Comments
 (0)