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 command:
% ps -ef | grep program-name
From dbx, type the following command:
(dbx) attach program-name pid
If dbx is not already running, type the following command:
% dbx program-name pid
Attaching to a running process pauses the process.
See the manual Oracle Solaris Studio 12.4: Debugging a Program With dbx for more information about attaching to a process.
From dbx, use the collector command to set up the data collection parameters and the cont command to resume execution of the process.
When you have finished collecting data, pause the program and then detach the process from dbx.
From dbx, type the following command:
(dbx) detach