远程调试 Gogland 停止
Remote debug Gogland halting
我需要有关使用 Delve 在 Gogland 中进行远程调试的帮助。
我尝试使用 IDE Goglang (1.0 EAP) 和 dlv link 在远程服务器上调试我的应用程序:https://github.com/derekparker/delve/
安装并尝试远程调试简单程序:
package main
import "fmt"
func main() {
fmt.Println("hello world")
for i:=uint(0); i< 10; i++{
fmt.Println(i)
}
}
首先,在远程主机上启动 dlv(控制台输出):
$ dlv debug --headless --listen=:2345 --log --api-version=2
API server listening at: [::]:2345
然后,在IDE开始远程调试:
从远程主机控制台输出:
2017/07/20 17:23:24 debugger.go:504: continuing
2017/07/20 17:23:24 debugger.go:493: halting
2017/07/20 17:23:24 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x47bb52, File:"/....../hello/hello.go", Line:6, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:23:24 debugger.go:504: continuing
2017/07/20 17:23:28 debugger.go:516: nexting
hello world
2017/07/20 17:23:28 debugger.go:516: nexting
2017/07/20 17:23:29 debugger.go:516: nexting
0
2017/07/20 17:23:29 debugger.go:516: nexting
02017/07/20 17:23:29 debugger.go:516: nexting
2017/07/20 17:23:29 debugger.go:516: nexting
1
2017/07/20 17:23:29 debugger.go:516: nexting
12017/07/20 17:23:30 debugger.go:516: nexting
2017/07/20 17:23:30 debugger.go:516: nexting
2
2017/07/20 17:23:30 debugger.go:516: nexting
42017/07/20 17:23:30 debugger.go:516: nexting
2017/07/20 17:23:30 debugger.go:516: nexting
3
2017/07/20 17:23:30 debugger.go:516: nexting
92017/07/20 17:23:31 debugger.go:516: nexting
2017/07/20 17:23:31 debugger.go:516: nexting
4
2017/07/20 17:23:31 debugger.go:516: nexting
162017/07/20 17:23:31 debugger.go:516: nexting
2017/07/20 17:23:31 debugger.go:516: nexting
5
2017/07/20 17:23:32 debugger.go:516: nexting
252017/07/20 17:23:32 debugger.go:516: nexting
2017/07/20 17:23:32 debugger.go:516: nexting
6
2017/07/20 17:23:32 debugger.go:516: nexting
362017/07/20 17:23:32 debugger.go:516: nexting
2017/07/20 17:23:32 debugger.go:516: nexting
7
2017/07/20 17:23:33 debugger.go:516: nexting
492017/07/20 17:23:33 debugger.go:516: nexting
2017/07/20 17:23:33 debugger.go:516: nexting
8
2017/07/20 17:23:34 debugger.go:516: nexting
642017/07/20 17:23:34 debugger.go:516: nexting
2017/07/20 17:23:34 debugger.go:516: nexting
9
2017/07/20 17:23:34 debugger.go:516: nexting
812017/07/20 17:23:34 debugger.go:516: nexting
2017/07/20 17:23:35 debugger.go:516: nexting
2017/07/20 17:23:35 debugger.go:516: nexting
一切如我所料(断点、F7、F8 等)
然后我尝试调试我的应用程序:
dlv debug --headless --listen=:2345 --log --api-version=2 -- --v --console
2017/07/20 17:26:51 debugger.go:97: launching process with args: [/home/...../debug --v --console]
API server listening at: [::]:2345
IDE开始
输出:
2017/07/20 17:26:55 debugger.go:493: halting
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x687a73, File:"/home/..........go", Line:136, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:2, Name:"", Addr:0x6869b2, File:"/home/..........go", Line:66, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:504: continuing
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:3, Name:"", Addr:0x687d33, File:"/home/........go", Line:143, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:504: continuing
2017/07/20 17:26:57 debugger.go:516: nexting
IDE 调试不工作(挂了)。如果我不使用断点应用程序启动和 运行 像往常一样 (运行).
我认为这条线是我遇到问题的原因:
2017/07/20 17:26:45 debugger.go:493: 暂停
为什么会出现??可能是我实用结构比较复杂(主包分为几个文件,当然还有外挂包等等)还是别的?
但是(!最有趣的!)是,如果您不是通过 IDE 而是通过控制台加入远程服务器,那么调试可以在一个简单的示例中进行,对于我的实用程序:
dlv connect HOSTNAME:2345
Type 'help' for list of commands.
(dlv) b ********.go:137
Breakpoint 1 set at 0x687a86 for main.main() /home/*************.go:137
(dlv) c
> main.main() /home/***************************.go:137 (hits goroutine(1):1 total:1) (PC: 0x687a86)
(dlv) n
输出:
$ dlv debug --headless --listen=:2345 --log --api-version=2 -- --v --console
2017/07/20 17:37:37 debugger.go:97: launching process with args: [/home/*****************/debug --v --console]
API server listening at: [::]:2345
2017/07/20 17:38:27 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x687a86, File:"/home/*******************.go", Line:137, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:38:35 debugger.go:504: continuing
2017/07/20 17:38:39 debugger.go:516: nexting
那些。怀疑IDE有错误,或者我做错了什么:).
我也尝试使用 dlv exec(已经构建应用程序)和其他命令进行调试。
感谢抽出宝贵时间回答问题,真心希望得到帮助。
P.S。我也很高兴知道您还可以使用什么来远程调试 GO 应用程序。
P.P.S。我尝试在 Atom.io 和 VS 代码中进行远程调试
在 Atom 中,仅使用 dlv.
进行语言环境调试
在 VS 代码中,本地调试器通过 dlv + 远程调试器工作,但断点不起作用!那些。 VS Code 也不是一个选项。
配置 VS 代码 (launch.json)
{
"version": "0.2.0",
"configurations": [
{
"name": "REMOTE",
"type": "go",
"request": "launch",
"mode": "remote",
"remotePath": "{workspaceRoot}",
"port": 2345,
"host": "REMOTE_HOST_NAME",
"program": "${workspaceRoot}", //"${fileDirname}",
"env": {},
"args": ["--v", "--console"],
"showLog": true
}
]
}
问题是基于 IDE 的。解决版本:
构建:EAP 12,172.3757.46
发布时间:2017 年 8 月 11 日
我需要有关使用 Delve 在 Gogland 中进行远程调试的帮助。
我尝试使用 IDE Goglang (1.0 EAP) 和 dlv link 在远程服务器上调试我的应用程序:https://github.com/derekparker/delve/
安装并尝试远程调试简单程序:
package main
import "fmt"
func main() {
fmt.Println("hello world")
for i:=uint(0); i< 10; i++{
fmt.Println(i)
}
}
首先,在远程主机上启动 dlv(控制台输出):
$ dlv debug --headless --listen=:2345 --log --api-version=2
API server listening at: [::]:2345
然后,在IDE开始远程调试:
从远程主机控制台输出:
2017/07/20 17:23:24 debugger.go:504: continuing
2017/07/20 17:23:24 debugger.go:493: halting
2017/07/20 17:23:24 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x47bb52, File:"/....../hello/hello.go", Line:6, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:23:24 debugger.go:504: continuing
2017/07/20 17:23:28 debugger.go:516: nexting
hello world
2017/07/20 17:23:28 debugger.go:516: nexting
2017/07/20 17:23:29 debugger.go:516: nexting
0
2017/07/20 17:23:29 debugger.go:516: nexting
02017/07/20 17:23:29 debugger.go:516: nexting
2017/07/20 17:23:29 debugger.go:516: nexting
1
2017/07/20 17:23:29 debugger.go:516: nexting
12017/07/20 17:23:30 debugger.go:516: nexting
2017/07/20 17:23:30 debugger.go:516: nexting
2
2017/07/20 17:23:30 debugger.go:516: nexting
42017/07/20 17:23:30 debugger.go:516: nexting
2017/07/20 17:23:30 debugger.go:516: nexting
3
2017/07/20 17:23:30 debugger.go:516: nexting
92017/07/20 17:23:31 debugger.go:516: nexting
2017/07/20 17:23:31 debugger.go:516: nexting
4
2017/07/20 17:23:31 debugger.go:516: nexting
162017/07/20 17:23:31 debugger.go:516: nexting
2017/07/20 17:23:31 debugger.go:516: nexting
5
2017/07/20 17:23:32 debugger.go:516: nexting
252017/07/20 17:23:32 debugger.go:516: nexting
2017/07/20 17:23:32 debugger.go:516: nexting
6
2017/07/20 17:23:32 debugger.go:516: nexting
362017/07/20 17:23:32 debugger.go:516: nexting
2017/07/20 17:23:32 debugger.go:516: nexting
7
2017/07/20 17:23:33 debugger.go:516: nexting
492017/07/20 17:23:33 debugger.go:516: nexting
2017/07/20 17:23:33 debugger.go:516: nexting
8
2017/07/20 17:23:34 debugger.go:516: nexting
642017/07/20 17:23:34 debugger.go:516: nexting
2017/07/20 17:23:34 debugger.go:516: nexting
9
2017/07/20 17:23:34 debugger.go:516: nexting
812017/07/20 17:23:34 debugger.go:516: nexting
2017/07/20 17:23:35 debugger.go:516: nexting
2017/07/20 17:23:35 debugger.go:516: nexting
一切如我所料(断点、F7、F8 等)
然后我尝试调试我的应用程序:
dlv debug --headless --listen=:2345 --log --api-version=2 -- --v --console
2017/07/20 17:26:51 debugger.go:97: launching process with args: [/home/...../debug --v --console]
API server listening at: [::]:2345
IDE开始
输出:
2017/07/20 17:26:55 debugger.go:493: halting
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x687a73, File:"/home/..........go", Line:136, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:2, Name:"", Addr:0x6869b2, File:"/home/..........go", Line:66, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:504: continuing
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:3, Name:"", Addr:0x687d33, File:"/home/........go", Line:143, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:504: continuing
2017/07/20 17:26:57 debugger.go:516: nexting
IDE 调试不工作(挂了)。如果我不使用断点应用程序启动和 运行 像往常一样 (运行).
我认为这条线是我遇到问题的原因:
2017/07/20 17:26:45 debugger.go:493: 暂停
为什么会出现??可能是我实用结构比较复杂(主包分为几个文件,当然还有外挂包等等)还是别的?
但是(!最有趣的!)是,如果您不是通过 IDE 而是通过控制台加入远程服务器,那么调试可以在一个简单的示例中进行,对于我的实用程序:
dlv connect HOSTNAME:2345
Type 'help' for list of commands.
(dlv) b ********.go:137
Breakpoint 1 set at 0x687a86 for main.main() /home/*************.go:137
(dlv) c
> main.main() /home/***************************.go:137 (hits goroutine(1):1 total:1) (PC: 0x687a86)
(dlv) n
输出:
$ dlv debug --headless --listen=:2345 --log --api-version=2 -- --v --console
2017/07/20 17:37:37 debugger.go:97: launching process with args: [/home/*****************/debug --v --console]
API server listening at: [::]:2345
2017/07/20 17:38:27 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x687a86, File:"/home/*******************.go", Line:137, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:38:35 debugger.go:504: continuing
2017/07/20 17:38:39 debugger.go:516: nexting
那些。怀疑IDE有错误,或者我做错了什么:).
我也尝试使用 dlv exec(已经构建应用程序)和其他命令进行调试。
感谢抽出宝贵时间回答问题,真心希望得到帮助。
P.S。我也很高兴知道您还可以使用什么来远程调试 GO 应用程序。
P.P.S。我尝试在 Atom.io 和 VS 代码中进行远程调试 在 Atom 中,仅使用 dlv.
进行语言环境调试在 VS 代码中,本地调试器通过 dlv + 远程调试器工作,但断点不起作用!那些。 VS Code 也不是一个选项。 配置 VS 代码 (launch.json)
{
"version": "0.2.0",
"configurations": [
{
"name": "REMOTE",
"type": "go",
"request": "launch",
"mode": "remote",
"remotePath": "{workspaceRoot}",
"port": 2345,
"host": "REMOTE_HOST_NAME",
"program": "${workspaceRoot}", //"${fileDirname}",
"env": {},
"args": ["--v", "--console"],
"showLog": true
}
]
}
问题是基于 IDE 的。解决版本: 构建:EAP 12,172.3757.46 发布时间:2017 年 8 月 11 日