vscode安装远程插件设置
https://www.cnblogs.com/xiujin/p/15171830.html
本地主机和远端的主机配置免密登录
将本地(一般是C:\Users\你的用户.ssh这里)
.ssh/id_rsa.pub文件中的内容追加到远端主
的/root/.ssh/authorized_keys文件中
,默认情况下linux的.ssh文件夹没有创建,
需要安装ssh和执行ssh-keygen -t rsa命令去生成
.ssh文件夹和里面带有的公钥id_rsa.pub私钥id_rsa两个文件
.然后执行vim authorized_keys去生成文件,
并将本地系统的.ssh/id_rsa.pub文件中的内容追加进去.
服务器设置:
遇到问题
Failed to set up socket for dynamic port forward to remote port
解决参考:VSCode Remote SSH Connection Failed,在配置文件中去掉AllowTcpForwarding =yes的注释即可
vi /etc/ssh/sshd_config
AllowTcpForwarding = yes
systemctl restart sshd
Vscode远程单步调试
1.配置launch.json
设置program(可执行程序路径)和cwd(工作路径)
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/EBS/build/EBS", //"输入程序名称,例如 ${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/EBS/build/",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
2.编译debug版本 cmake -DCMAKE_BUILD_TYPE=Debug …
3.运行调试,添加断点