MyTinySDL阅读之一:vscode运行调试
如何优雅的使用vscode进行debug
下载最新的MyTinySTL-Tutorial源码,我已经将.vscode文件夹上传了,配置好了可以进行调试,选中Test/test.cpp文件,然后点击运行tab里面的运行即可。
详细教学文档见:Using Clang in Visual Studio Code
tasks.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"tasks": [
{
"type": "cppbuild",
"label": "运行test.cpp",
"command": "/usr/bin/clang++",
"args": [
"-std=c++11",
"-stdlib=libc++",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
}
Launch.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "运行test.cpp"
}
]
}
本文由作者按照 CC BY 4.0 进行授权