These are chat archives for derekparker/delve

21st
Aug 2017
Andrew Sharp
@ags799
Aug 21 2017 16:24

i'm adding delve to a docker-compose setup. each container has a web server process that we may or may not want to debug upon running the complete docker-compose setup. ideally, on running docker-compose up, all containers would get up and running, and if we wanted to debug a particular container, we could remote-attach to that container's web server process after the web server has started running. then we could set breakpoints in the HTTP handlers & debug to our heart's content.

is it possible for dlv debug to initiate a debug session and automatically "continue" so that the process begins running? now it seems that one must run dlv debug --headless and then in a separate terminal attach to the debug session & "continue" it manually.

Alessandro Arzilli
@aarzilli
Aug 21 2017 16:31
we don't have that but there is dlv attach
Andrew Sharp
@ags799
Aug 21 2017 16:32
so we would run the containers & then dlv attach in some script to "continue" them?
Alessandro Arzilli
@aarzilli
Aug 21 2017 16:33
When you want to debug one of them you use dlv attach --headless <pid> then connect to it from outside the container
Andrew Sharp
@ags799
Aug 21 2017 16:34
oh oh i think i found a way. we can do dlv debug some/package --headless --init <(echo continue)
Alessandro Arzilli
@aarzilli
Aug 21 2017 16:34
I don't think that works
implementing this should be simple, all you need is add some handshake between the rpc2/server.go and rpc2/client.go so that the client can figure out that the process is already running and the server can send back the output of Continue to a client that connected after the process started
Alessandro Arzilli
@aarzilli
Aug 21 2017 16:40
if you want to implement it, it can be done without knowing anything about debuggers, I think you have a solid use case
but post an issue first, see what Derek thinks
Andrew Sharp
@ags799
Aug 21 2017 16:40
okay thanks will see if the --init <(continue) works first
would be glad to contribute!