I am trying to debug a service. The usual procedure is to start the service and attach gdb to the process. But I want to debug the code when the service is still starting up. It takes a while for gdb to load the libraries, and the required code has executed before I can put the breakpoints. Any idea how to do it? Thanks!
Share
Let’s assume your service is called “myservice.exe”
If you can get on the box that the code is actually running on, then I would do the following:
This should get you what you want.
Note: if you can’t run gdb directly, then put a “sleep” statement for 1 minute at the very start (before the part you want to debug) – that should allow you to connect before it starts the sensitive code.