需要安装的VSCode插件
C/C++
CMake Tools
Remote - WSL 这个是用来连接安装在Windows的Linux子系统的
Remote - SSH 这个是连接远程Linux的
Remote - SSH: Editing Configuration Files
Remote Development
Remote - Containers
Remote Workspace
这些官方文档可以边读边试,还是很容易用的。
Remote Development with Linux
https://code.visualstudio.com/docs/remote/linux
Debugging
https://code.visualstudio.com/docs/editor/debugging#_launch-configurations
Developing in WSL
https://code.visualstudio.com/docs/remote/wsl#_getting-started
Using C++ and WSL in VS Code
https://code.visualstudio.com/docs/cpp/config-wsl
launch.json
(gdb) Attach 附加到已经运行的进程上调试
(gdb) Launch 以调试方式启动
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceFolder}/build/ft_trade_6_3_15",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/ft_trade_6_3_15",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}