VSCode远程调试Go程序方法(Attach)

  1. set launch.json
        {
            "name": "Attach",
            "type": "go",
            "request": "launch",
            "mode": "remote",
            "remotePath": "${workspaceRoot}",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${workspaceRoot}",
            "env": {},
            "args": [],
            "showLog": true
        }
  1. go build && run
  2. get pid && dlv attach pid --headless --listen=:2345 --log
  3. in VSCode, Click begin debug button

猜你喜欢

转载自www.cnblogs.com/mrblue/p/9069084.html