原文出处:https://blog.csdn.net/fonnn/article/details/104065273
更新了mac新系统Calalina,第一天发现需要更新某个Xcode命令行环境包(一脸懵)才可以使include不报错。
更新之后的第二天,发现打的断点无效了,调试如同直接运行。
正文如下
1)VSCode中下载CodeLLDB扩展
2)把launch.json、tasks.json两个配置文件内容更换掉,换成
lauch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "clang++ build and debug active file",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.out",
"args": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": "clang++ build active file"
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "clang++ build active file",
"type": "shell",
"command": "clang++",
"args": [
"${fileBasename}",
"-o",
"${fileBasenameNoExtension}.out",
"-g"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
完事儿记得安装CodeLLDB插件
launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "clang++ - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
"preLaunchTask": "C/C++: clang++ build active file"
}
]
}
tasks.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}