-
-
Notifications
You must be signed in to change notification settings - Fork 42
DAP support cpp
Zeioth edited this page Aug 8, 2023
·
14 revisions
Create a .solution
file in your working directory. Then pass the -g
parameter to the compiler like this
[HELLO WORLD]
entry_point="/path/to/my/entry_point_file/main.cpp"
output="/path/where/the/program/will/be/written/hello_world"
parameters="-g"
That will tell the compiler to compile in debug mode.
Please note that this section has nothing to do with compiler.nvim. I'm documenting this to make your life easier. To debug C++ with DAP you have to:
- Install the package
lldb
in your system - Setup
DAP
for C++
Here you have an example of how to configure DAP for C++
local dap = require("dap")
-- C++
dap.adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode', -- path of your netcoredbg executable
name = 'lldb'
}
dap.configurations.c = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function() -- Ask the user what executable wants to debug
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/bin/program', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
},
}
Compile your program with Build solution
, add a break point to your code, and then run DAP
. You will see something like this.
![screenshot_2023-08-08_02-33-14_125206035](h