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

Issue

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.

Solution

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

Answered By – Hana

Answer Checked By – Mildred Charles (GoLangFix Admin)

Leave a Reply

Your email address will not be published.