建议包的安装都是使用yay方式
vscode 插件: tsoding theme + cmake tools + C++(微软的) + emacs friendly key
main.cpp 在main函数打断点, 开始使用gdb lauch
lauch.json 打入gdb
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/main",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
观察效果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/0f336b848d215bd17728b379b1de7d49.png)