前言
使用golang一段时间了,goland已经过期。vscode如何attach管理员权限的go程序呢?
使用步骤
vscode + dlv即可实现调试本机管理员权限的go程序
步骤0-启动目标进程
启动带调试信息的目标程序
步骤1-vscode配置
vscode settings.json中的配置
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "remote",
"processId": 0,
"port":2345,
"host":"127.0.0.1"
}
步骤2-启动dlv程序
使用dlv作为远程调试服务器
# $pid为attach的目标进程
# 管理员权限启动dlv程序
dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient attach $pid