JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: Debugging a Program With dbx     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information


1.  Getting Started With dbx

2.  Starting dbx

3.  Customizing dbx

4.  Viewing and Navigating To Code

5.  Controlling Program Execution

Running a Program

Attaching dbx to a Running Process

Detaching dbx From a Process

Stepping Through a Program

Single Stepping

Stepping Into a Function

Continuing Execution of a Program

To Resume Program Execution at a Specific Line

Calling a Function

Call Safety

Using Ctrl+C to Stop a Process

6.  Setting Breakpoints and Traces

7.  Using the Call Stack

8.  Evaluating and Displaying Data

9.  Using Runtime Checking

10.  Fixing and Continuing

11.  Debugging Multithreaded Applications

12.  Debugging Child Processes

13.  Debugging OpenMP Programs

14.  Working With Signals

15.  Debugging C++ With dbx

16.  Debugging Fortran Using dbx

17.  Debugging a Java Application With dbx

18.  Debugging at the Machine-Instruction Level

19.  Using dbx With the Korn Shell

20.  Debugging Shared Libraries

A.  Modifying a Program State

B.  Event Management

C.  Macros

D.  Command Reference


Attaching dbx to a Running Process

You might need to debug a program that is already running. You would attach to a running process if:

You can attach dbx to a running program by using the program’s process_id number as an argument to the dbx debug command.

Once you have debugged the program, you can then use the detach command to take the program out from the control of dbx without terminating the process.

If you quit dbx after attaching it to a running process, dbx implicitly detaches before terminating.

To attach dbx to a program that is running independently of dbx, you can use either the attach command or the debug command.

To attach dbx to a process that is already running, type:

(dbx) debug program_name process_id


(dbx) attach process_id

You can substitute a– (dash) for the program_name; dbx automatically finds the program associated with the process ID and loads it.

For more information, see debug Command and attach Command.

If dbx is not running, start dbx by typing:

% dbx program_name process_id

After you have attached dbx to a program, the program stops executing. You can examine it as you would any program loaded into dbx. You can use any event management or process control command to debug it.

When you attach dbx to a new process while you are debugging an existing process, the following occurs:

If the process to which you are attaching dbx is stopped due to a SIGSTOP signal, SIGTSTOP signal, SIGTTIN signal, or SIGTTOUT signal, the attach succeeds with a message like the following:

dbx76: warning: Process is stopped due to signal SIGSTOP

The process is inspectable, but to resume it you need to send it a SIGCONT signal with the cont command:

(dbx) cont -sig cont

You can use runtime checking on an attached process with certain exceptions. See Using Runtime Checking on an Attached Process.