f78
Debugging an already-running process
To use
When using
The first thing GDB does after arranging to debug the specified process is to
stop it. You can examine and modify an attached process with all the GDB
commands that are ordinarily available when you start processes with
If you exit GDB or use the
This command attaches to a running process—one that was started outside GDB. (info files shows your active targets.) The command takes as argument a process ID. The
usual way to find out the process-id of a Unix process is with the ps utility, or with the ‘jobs -l’ shell command.
When you have finished debugging the attached process, you can use the detach command to release it from GDB control. Detaching the process continues its
execution. After the detach command, that process and GDB become completely independent once more, and
you are ready to attach another process or start one with run. detach does not repeat if you use the Return key again after executing t
2a7
he command.