本文介绍如何在 VSCode 下配置 Google Test 的断点调试环境,包括 launch.json 和 tasks.json 的标准写法,以及调试流程说明。
1. 配置 launch.json
在 .vscode/launch.json
中添加如下内容:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug GTest (Auto)",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "cmake: build"
}
]
}
小于 1 分钟