-
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
Allow attaching to a process without pausing the execution #245
Comments
I can't see the value of starting an actual debug session without pausing unless you're simply relying on providing an You can already set tracepoints without stopping the program indefinitely with the |
@derekparker I run the code in a docker container and remote debug. So for normal development its nice to auto run, then I could click the play button on VSCODE to attach, add a breakpoint and rerun to hit the breakpoint. it would be quite convinient to be able to do this. |
reflex -s -r '.go$' -- dlv --listen=:5432 debug --headless=true --init <(printf continue) |
…lients This pull request makes several changes to delve to allow headless instancess that are started with the --accept-multiclient flag to keep running even if there is no connected client. Specifically: 1. Makes a headless instance started with --accept-multiclient quit after one of the clients sends a Detach request (previously they would never ever quit, which was a bug). 2. Changes proc/gdbserial and proc/native so that they mark the Process as exited after they detach, even if they did not kill the process during detach. This prevents bugs such as go-delve#1231 where we attempt to manipulate a target process after we detached from it. 3. On non --accept-multiclient instances do not kill the target process unless we started it or the client specifically requests it (previously if the client did not Detach before closing the connection we would kill the target process unconditionally) 4. Add a -c option to the quit command that detaches from the headless server after restarting the target. 5. Change terminal so that, when attached to --accept-multiclient, pressing ^C will prompt the user to either disconnect from the server or pause the target process. Also extend the exit prompt to ask if the user wants to keep the headless server running. Implements go-delve#245, go-delve#952, go-delve#1159, go-delve#1231
…lients This pull request makes several changes to delve to allow headless instancess that are started with the --accept-multiclient flag to keep running even if there is no connected client. Specifically: 1. Makes a headless instance started with --accept-multiclient quit after one of the clients sends a Detach request (previously they would never ever quit, which was a bug). 2. Changes proc/gdbserial and proc/native so that they mark the Process as exited after they detach, even if they did not kill the process during detach. This prevents bugs such as go-delve#1231 where we attempt to manipulate a target process after we detached from it. 3. On non --accept-multiclient instances do not kill the target process unless we started it or the client specifically requests it (previously if the client did not Detach before closing the connection we would kill the target process unconditionally) 4. Add a -c option to the quit command that detaches from the headless server after restarting the target. 5. Change terminal so that, when attached to --accept-multiclient, pressing ^C will prompt the user to either disconnect from the server or pause the target process. Also extend the exit prompt to ask if the user wants to keep the headless server running. Implements go-delve#245, go-delve#952, go-delve#1159, go-delve#1231
…lients This pull request makes several changes to delve to allow headless instancess that are started with the --accept-multiclient flag to keep running even if there is no connected client. Specifically: 1. Makes a headless instance started with --accept-multiclient quit after one of the clients sends a Detach request (previously they would never ever quit, which was a bug). 2. Changes proc/gdbserial and proc/native so that they mark the Process as exited after they detach, even if they did not kill the process during detach. This prevents bugs such as go-delve#1231 where we attempt to manipulate a target process after we detached from it. 3. On non --accept-multiclient instances do not kill the target process unless we started it or the client specifically requests it (previously if the client did not Detach before closing the connection we would kill the target process unconditionally) 4. Add a -c option to the quit command that detaches from the headless server after restarting the target. 5. Change terminal so that, when attached to --accept-multiclient, pressing ^C will prompt the user to either disconnect from the server or pause the target process. Also extend the exit prompt to ask if the user wants to keep the headless server running. Implements go-delve#245, go-delve#952, go-delve#1159, go-delve#1231
…lients This pull request makes several changes to delve to allow headless instancess that are started with the --accept-multiclient flag to keep running even if there is no connected client. Specifically: 1. Makes a headless instance started with --accept-multiclient quit after one of the clients sends a Detach request (previously they would never ever quit, which was a bug). 2. Changes proc/gdbserial and proc/native so that they mark the Process as exited after they detach, even if they did not kill the process during detach. This prevents bugs such as #1231 where we attempt to manipulate a target process after we detached from it. 3. On non --accept-multiclient instances do not kill the target process unless we started it or the client specifically requests it (previously if the client did not Detach before closing the connection we would kill the target process unconditionally) 4. Add a -c option to the quit command that detaches from the headless server after restarting the target. 5. Change terminal so that, when attached to --accept-multiclient, pressing ^C will prompt the user to either disconnect from the server or pause the target process. Also extend the exit prompt to ask if the user wants to keep the headless server running. Implements #245, #952, #1159, #1231
Closed by 9a21621 |
@aarzilli I read the changelog of the commit that closed this but I'm not sure how to use delve to do it (and I haven't tried it yet either). Is the original reported case possible now? Thank you. |
|
In case of
Thus a separate client connection is needed to start the process; this is not container friendly and some hack is needed to trigger the operation externally. |
I'm not sure if this problem is solved, but in some scenarios it can be nice to start a go binary with delve without pausing the execution, like running java with |
I'm going to reopen this as it technically is not fixed, we currently just support a workaround. |
Having a no-suspend option is useful for debugging go-based microservices in containers. |
…lients This pull request makes several changes to delve to allow headless instancess that are started with the --accept-multiclient flag to keep running even if there is no connected client. Specifically: 1. Makes a headless instance started with --accept-multiclient quit after one of the clients sends a Detach request (previously they would never ever quit, which was a bug). 2. Changes proc/gdbserial and proc/native so that they mark the Process as exited after they detach, even if they did not kill the process during detach. This prevents bugs such as go-delve#1231 where we attempt to manipulate a target process after we detached from it. 3. On non --accept-multiclient instances do not kill the target process unless we started it or the client specifically requests it (previously if the client did not Detach before closing the connection we would kill the target process unconditionally) 4. Add a -c option to the quit command that detaches from the headless server after restarting the target. 5. Change terminal so that, when attached to --accept-multiclient, pressing ^C will prompt the user to either disconnect from the server or pause the target process. Also extend the exit prompt to ask if the user wants to keep the headless server running. Implements go-delve#245, go-delve#952, go-delve#1159, go-delve#1231
…lients This pull request makes several changes to delve to allow headless instancess that are started with the --accept-multiclient flag to keep running even if there is no connected client. Specifically: 1. Makes a headless instance started with --accept-multiclient quit after one of the clients sends a Detach request (previously they would never ever quit, which was a bug). 2. Changes proc/gdbserial and proc/native so that they mark the Process as exited after they detach, even if they did not kill the process during detach. This prevents bugs such as go-delve#1231 where we attempt to manipulate a target process after we detached from it. 3. On non --accept-multiclient instances do not kill the target process unless we started it or the client specifically requests it (previously if the client did not Detach before closing the connection we would kill the target process unconditionally) 4. Add a -c option to the quit command that detaches from the headless server after restarting the target. 5. Change terminal so that, when attached to --accept-multiclient, pressing ^C will prompt the user to either disconnect from the server or pause the target process. Also extend the exit prompt to ask if the user wants to keep the headless server running. Implements go-delve#245, go-delve#952, go-delve#1159, go-delve#1231
Sorry, the issue was created too fast :D
Proper description:
Given the following app:
When I'm doing the following steps:
I can observe a pause in execution until I send the
continue
command to the debugger.While I do understand that it might be useful to have that functionality, say for example I want to hook up in a staging app that has traffic on it (sample traffic), attaching to its process and having it paused is not ideal (for example I want to set tracepoints rather that breakpoints).
Do you think it would be useful to have an
attach --no-pause
flag?The text was updated successfully, but these errors were encountered: