Attaching to a Running Process
Related Topics:
If you want to debug a program that is already running, you can attach to it using the Attach Process dialog box.
You might attach a running process if:
- You want to debug a running server and you do not want to stop or kill it.
- You want to debug a running GUI program, and you don't want to restart it.
- Your program is looping indefinitely, and you want to debug it without killing it.
To attach to a running process:
- 1. In the Sun WorkShop main window or the Debugging Window, choose Debug
Attach Process.
- The Attach Process Dialog Box displays a scrolling list of all active processes on your machine that have your User ID.
- 2. Select the process you want to attach to.
- 3. Type the path name of the program in the Program Pathname text box.
- You can attach to a process without entering the program name, but you will not be able to run the program at a later time.
- 4. Click Attach.
- The process stops executing and is under debugging control. You can now set breakpoints, step through the program, evaluate expressions, or run any other debugging commands.
Note - Make sure that your program was compiled with -g to use full debugging functionality. Once you have debugged the program, choose Execute
Detach Program from the Debugging window to let the process run autonomously.