windows下通过vscode远程调试linux c/cpp程序配置
- vscode插件配置
- linux依赖工具安装
- launch.json配置
vscode插件配置
CodeLLDB插件需要提前下载:
linux依赖工具安装
sudo apt update
sudo apt install cmake clangd
launch.json配置
{"version": "0.2.0","configurations": [{"name": "Debug C Program", // 配置名称,会显示在 VS Code 的调试下拉菜单里"type": "lldb", // 调试器类型,必须是 lldb 才能使用 CodeLLDB 插件"request": "launch", // 调启动模式,launch 表示直接启动程序调试;attach 表示附加到已运行进程"program": "${command:cmake.launchTargetPath}", // 可执行文件路径,支持变量 ${workspaceFolder} 表示当前工作区根目录"args": [], // 启动程序时的命令行参数"cwd": "${workspaceFolder}", // 调试器的工作目录"stopOnEntry": false // 是否在程序入口处暂停,true 表示暂停等待你手动继续}]
}