Golang深入探讨,如何启动调试器并启动正在调试的应用程序?

I am trying to setup a headless delve debugger that I can attach to remotely.

I am unable to find a way to launch a debugging server that doesn't pause the application I am debugging.

I have been using dlv attach --headless=true --listen=:2345 attach 32 but this pauses the process.
Alternatively I could use dlv --headless=true --listen=:2345 exec app if this allowed the app binary to run.

I don't know if the init file can do something like this? I cannot find any documentation on what that actually is.

If you consider delve issue 145, that might be a feature, not a bug:

I can't see the value of starting an actual debug session without pausing unless you're simply relying on providing an init file (to load breakpoints / tracepoints) and then want to immediately continue execution, which you could do by writing a continue command at the end of the init file.

You can already set tracepoints without stopping the program indefinitely with the trace subcommand, which takes a pid flag.


That being said, with Delve 1.3.0 (August 2019, 2 years later):

go-delve/delve issue 245 is resolved by PR 1585

cmd/dlv: add --continue to continue process on launch/attach

Add --continue option for attach, debug, exec, and trace, to issue a continue on start.

The main use case for this feature would be to start a headless delve server (for example within a container)