golang dlv remote debugging

Because I don't know how delvel sets up the source code, the local compiled upload is uploaded to the server, and the server cannot see the source code for debugging, which is very sad, so just use remote debugging:

Find the process pid of gameserver on the server ps x|grep game

Then on the server command line enter:
dlv attach $PID --headless --api-version=2 --log --listen=:8181

This machine only needs to enter:

dlv connect www.example.com:8181Connect to the dlv process on the server, and you can debug remotely on this machine.

have to be aware of is

After the local machine quits, the remote dlv process will also end.
There is no dlv connect on the local machine, and the direct closing of the remote dlv will cause the PID of the remote debugging process to exit directly (very sad).
After the local dlv enters quit, it will let you choose whether to close the debugging process. This is sometimes convenient, but most of them are Select N to not close the debug process PID

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325319372&siteId=291194637