Abel'Blog

我干了什么?究竟拿了时间换了什么?

0%

go-debug

在Linux里面使用gdb/delve工具来调试程序。

安装

Linux

1
go get github.com/go-delve/delve/cmd/dlv

vscode中的-workspace中配置一份调试选项:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
"configurations": [
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
// "remotePath": "${workspaceFolder:bin}\\Lobby.exe",
"presentation": {
"hidden": false,
"group": "1",
"order": 2
},
"processId": 2956
},

使用vscode,安装连接到远程,工具栏里面选择“运行”-“安装附加调试器”

1
Could not attach to pid 2956: this could be caused by a kernel security setting, try writing "0" to /proc/sys/kernel/yama/ptrace_scope

参考