-
Notifications
You must be signed in to change notification settings - Fork 770
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
Attached debugger does not remove breakpoints before disconnecting #2368
Comments
Yes, go-delve/delve#2772 and go-delve/delve#2958 (comment) discuss this issue but I don't know what's the current status of Delve DAP. @polinasok Is there any reason that the This is a regression compared to the legacy debug adapter, and this needs to be resolved before we completely switch over to the dlv-dap adapter. @briandealwis @suzmue |
Do you mean that the issue is
I think it's already too late for this; Some bugs have been fixed for DAP only, so the legacy adapter is also not fully usable in that case, which leaves no choice for some users to switch over to the dlv-dap adapter. |
@OrBin |
Thanks @hyangah. Do you have any expectation regarding whether this is going to be done and when? |
@hyangah Where are you seeing this legacy behavior? We generally tried to follow its example where it made sense. I do not see any clearing by the legacy adapter in the code vscode-go/src/debugAdapter/goDebug.ts Lines 1008 to 1015 in 84fe4e7
vscode-go/src/debugAdapter/goDebug.ts Lines 830 to 838 in 84fe4e7
Here is a log when I click Continue, then Disconnect while printing numbers in a loop with conditional breakpoint in the middle of the range.
|
An update here might be of interest: go-delve/delve#2958 (comment). I am pretty sure we didn't clear the breakpoints because the legacy adapter didn't, and we generally aimed for feature parity (unless it was a bug or a known pain point). That said, this is a new adapter, and we are in our right to define the default case the way we see fit regardless of what the legacy adapter did or did not do. We can clear and keep async logic simple in v1 and then maybe add an option to keep the breakpoints and update async logic accordingly in v2. Just need to document our decision, so users can let us know if they want the extra option. @OrBin Another workaround is one-click clearing from the UI (not sure how to trigger automatically though). |
Yes, you are right. I misremembered it and this feature was never implemented. There was a prior UX issue report caused by this left-over breakpoints (#497 (comment) including myself). Can we change to clear breakpoints? It is more intuitive and safer. I hope that simplifies delve dap code path too. Users who want to leave breakpoints around after the debug sessions are over should understand the implication well and explicitly opt in. Using the |
Clearing all breakpoints after disconnecting is an intuitive and side-effect-free behavior. Otherwise, the program will get stuck when it reaches a breakpoint, even though we are not debugging. |
I just got the debugger set up for Go in VSCode, and got bit with this almost immediately. It's especially annoying if you are using an attach workflow and you set a breakpoint, disconnect, and remove the breakpoint. The editor seems to imply there are no breakpoints at that point, but the code is still halted. |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
Go 1.18
VS Code 1.69.2
VS Code Go 0.35.1
Share the Go related settings you have added/edited
Default settings
Describe the bug
Using a remote debugging configuration with
"attach"
request (from launch.json), attaching the debugger, defining a breakpoint, then clicking "disconnect", the debugee continue running (as expected), but still has the breakpoints set, so that it stops in the breakpoints. This is a weird, unexpected behavior. GoLand, for example, sendsClearBreakpoint
commands to dlv server for all registered breakpoints.Instead,
vscode-go
just closes the connection without letting the process go back to the previous (=breakpointless) state.For now, I worked around this with a script I added as a
postDebugTask
to open a socket to dlv server and clear all breakpoints. This is not a sustainable solution though.Here is the relevant section in the code, AFAICT:
vscode-go/src/debugAdapter/goDebug.ts
Lines 830 to 839 in 944b1d4
Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: