为什么设置断点会暂停我的 Golang 进程的执行?

huangapple go评论80阅读模式
英文:

Why does setting a breakpoint pause execution of my golang process?

问题

在macOS 12.3上使用vscode 1.66.0(go for vscode 0.32和dlv 1.7)调试本地运行的golang 1.17服务器进程时,设置新的断点会暂停进程的执行。我似乎总是忘记取消暂停执行,可能是因为我不理解为什么会暂停执行,每天多次都要等待几秒钟才能完成调用或触发断点,然后灵光一现,我才记得手动取消暂停调试器。

我还没有找到是否可以修改这种行为的方法,比如在launch.json中设置或者在dlv或vscode扩展中设置,因为我非常希望在设置断点时不要暂停虚拟机。这种可能吗?如果这是环境所要求的,那就没问题,但如果不是,我想知道是否有一些我不理解的目的。

英文:

When debugging a local running golang 1.17 server process on macOS 12.3 in vscode 1.66.0 (go for vscode 0.32 and dlv 1.7), setting a new breakpoint pauses execution of the process. I seem to have a mental block over remembering to un-pause the execution, maybe because I don't understand why it pauses the execution, and multiple times per day I sit there waiting a few seconds for a call to complete, or to trip the breakpoint, before the light bulb flickers on and I remember to manually un-pause the debugger.

I haven't found if this behaviour is modifiable, like a launch.json setting or something in dlv or the vscode extension, because I very much would like it to not pause the vm when I set a breakpoint. Is this possible? If it's something required of the environment, then ok, but if not, then I'd wonder if there's some purpose behind it I don't understand.

答案1

得分: 3

dlv v1.7.3修复了该问题并自动恢复执行。最新的dlv版本是1.8.2。

英文:

dlv v1.7.3 fixed the issue and auto-resumes execution
https://github.com/go-delve/delve/blob/master/CHANGELOG.md#added-3 The latest dlv version is 1.8.2

huangapple
  • 本文由 发表于 2022年4月20日 01:11:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/71928766.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定