VSCode CMake 调试断点不停
Root Cause
需要 Debug Build 才可以调试
Action
需要在 tasks.json
中的 cmake
任务添加 "-DCMAKE_BUILD_TYPE=Debug"
参数
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "launch after cmake build",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/build/play",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"preLaunchTask": "CMake Build",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
tasks.json
{
"options": {
"cwd": "${workspaceFolder}/build"
},
"tasks": [
{
"label": "cmake",
"command":"cmake",
"args": ["-DCMAKE_BUILD_TYPE=Debug", ".."]
},
{
"label": "make",
"command":"make",
},
{
"label": "CMake Build",
"dependsOn":[
"cmake",
"make"
],
}
],
"version": "2.0.0"
}
Reference: https://blog.csdn.net/weixin_43878193/article/details/103656526
本文作者:Zijian/TENG(微信公众号:好记性如烂笔头),转载请注明原文链接:https://www.cnblogs.com/tengzijian/p/vscode-cmake-debug-breakpoint.html