-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-stop mode debugging #777
Comments
It's possible to implement this but very complicated. |
@aarzilli Thanks for your reply, it's really helpful for us when debugging web applications |
+1 to this. |
And what should happen when a second breakpoint is hit in the background? |
@au-phiware when a breakpoint is hit in the background, then that goroutine is paused on that breakpoint, that's what happens while debugging java, for example. To make things clear: say we have 3 goroutines, 2 share the same code (let's call I'm not trying to say it's an easy feature to implement, though I think it's the desired behavior and also probably many other debuggers work that way. |
This feature would help tremendously when debugging multithreaded code with event listeners, endpoint handlers, and other background GoRoutines running in a Kubernetes cluster. |
For reference, the term "non-stop mode" comes from GDB, where it means that the debugger stops one thread* of the target program, while other threads continue to run. In Go, the unit of concurrent work is a goroutine, not a thread. Go's runtime has its own scheduler, which may schedule more than one goroutine per thread. Therefore, stopping a single thread is not enough to provide a "non-stop mode" experience equivalent to that in GDB. For example, let's say you have a program with two goroutines, A and B. You want to stop A, and allow B to continue to run. At the time you want to stop A, both A and B are scheduled to run on the same thread. If you stop that thread, both A and B stop. If I understand it correctly, support for "non-stop mode" depends on the ability to stop a single goroutine, tracked by #1529. That ability depends on Go runtime support. The relevant runtime issue is golang/go#31132. The issue was discussed at the go runtime meeting in September 2022. * thread throughout means operating system thread. |
dellve: 0.12.1
go:1.7.4
os: macos sierra 10.12.3
background: when i debugging a websocket program, the goroutine who should pong the server's ping request in backgrond but it's pause automatically when breakpoint hit in other functionality, so the websocket connection will close after timeout. So i want that goroutine keep running.
example:
The text was updated successfully, but these errors were encountered: