When I want to use CMake extention of VS Code in MacOS to debug program using LLDB, it requre some set up to use F5
button.
- Install VS Code, LLVM, CMAKE and C/C++ extensions.
- Using
LLDM-MI
- Compile lldb-mi from source, then make install (default to
/usr/local/bin
) - Using LLDB-MI in VS Code
- Compile lldb-mi from source, then make install (default to
tasks.json
:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "{cmake.debugTarget}",
"options": {
"cwd": "${workspaceFolder}/build"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "MacOS Cmake LLDB",
"type": "cppdbg",
"request": "launch",
"preLaunchTask": "build",
"args": [],
"stopAtEntry": false,
"program": "${command:cmake.launchTargetPath}",
"MIMode": "lldb",
"miDebuggerPath": "/usr/local/bin/lldb-mi",
"cwd": "${workspaceFolder}/build"
}
]
}
settings.json
:
{
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}
References: