Sun Studio 12: Debugging a Program With dbx

Attaching to Child Processes

You can attach to a running child process in one of the following ways.

$ dbx program_name process_id

(dbx) debug program_name process_id

You can substitute program_name with the name - (minus sign), so that dbx finds the executable associated with the given process ID (process_id). After using a -, a subsequent run command or rerun command does not work because dbx does not know the full path name of the executable.

You can also attach to a running child process using the Debugger window in the Sun Studio IDE. (See “Attaching the Debugger to a Running Process” in the IDE online help.)