vscode 使用dlv远程调试golang程序
时间:2022-11-25 17:50:36.075 +0800 CST 浏览:680

编译

GOOS=linux GOARCH=amd64 go build -gcflags="all = -N -l"  main.go

远程机器

# ${pid} 远程机器上运行go程序的pid
dlv --listen=:2345 --headless=true --api-version=2 attach ${pid}

vscode launch.json配置

{
    "name": "remote debug",
    "type": "go",
    "request": "attach",
    "mode": "remote",
    "cwd": "${workspaceFolder}/testgo",
    "port": 2345,
    "host": "10.200.20.117" // 远程机器的host
}


如果这篇文章对你有所帮助,可以通过下边的“打赏”功能进行小额的打赏。

本网站部分内容来源于互联网,如有侵犯版权请来信告知,我们将立即处理。


来说两句吧