debugging - Golang delve,如何启动调试器并启动正在调试的应用程序?

标签 debugging go delve

我正在尝试设置一个可以远程连接的 headless Delve 调试器。

我无法找到一种方法来启动不会暂停我正在调试的应用程序的调试服务器。

我一直在使用 dlv attach --headless=true --listen=:2345 attach 32 但这会暂停进程。
或者我可以使用 dlv --headless=true --listen=:2345 exec app 如果这允许应用程序二进制文件运行。

不知道init文件能不能做这样的事情?我找不到关于它到底是什么的任何文档。

最佳答案

如果你考虑delve issue 145 ,这可能是一个特性,而不是一个错误:

I can't see the value of starting an actual debug session without pausing unless you're simply relying on providing an init file (to load breakpoints / tracepoints) and then want to immediately continue execution, which you could do by writing a continue command at the end of the init file.

You can already set tracepoints without stopping the program indefinitely with the trace subcommand, which takes a pid flag.


也就是说,Delve 1.3.0 (2019 年 8 月,2 年后):

go-delve/delve issue 245PR 1585 解决

cmd/dlv: add --continue to continue process on launch/attach

Add --continue option for attach, debug, exec, and trace, to issue a continue on start.

The main use case for this feature would be to start a headless delve server (for example within a container)

关于debugging - Golang delve,如何启动调试器并启动正在调试的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45856590/

相关文章:

debugging - 改善Lua错误消息

http - golang 接受 gzip 后的数据

go - 将 delve 调试器与 go 模块一起使用

c - 空指针的 Golang 等价物是什么

go - 为什么 goroutine 这么慢?

goland - GoLang 调试器在标准输入上卡住

docker - 从主机使用 Delve/Goland 在容器中调试 Go 进程

javascript - BestBuy 网站上 Internet Explorer 8 中非常奇怪的极端情况行为

visual-studio-2010 - 从 Visual Studio 2010 调试 VB6 代码

javascript - 为什么这会失去排序顺序?