Determine the program’s process ID (PID).
If you started the program from the command line and put it in the background, its PID will be printed to standard output by the shell. Otherwise you can determine the program’s PID by typing the following.
% ps -ef | grep program-name |
Attach to the process.
From dbx, type the following.
(dbx) attach program-name pid |
If dbx is not already running, type the following.
% dbx program-name pid |
Attaching to a running process pauses the process.
See the manual, Sun Studio 12: Debugging a Program With dbx, for more information about attaching to a process.
Start data collection.
From dbx, use the collector command to set up the data collection parameters and the cont command to resume execution of the process.
Detach from the process.
When you have finished collecting data, pause the program and then detach the process from dbx.
From dbx, type the following.
(dbx) detach |