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

Document Information

Preface

1.  Getting Started With dbx

Compiling Your Code for Debugging

Starting dbx or dbxtool and Loading Your Program

Running Your Program in dbx

Debugging Your Program With dbx

Examining a Core File

Setting Breakpoints

Stepping Through Your Program

Looking at the Call Stack

Examining Variables

Finding Memory Access Problems and Memory Leaks

Quitting dbx

Accessing dbx Online Help

2.  Starting dbx

3.  Customizing dbx

4.  Viewing and Navigating To Code

5.  Controlling Program Execution

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.  Command Reference

Index

Starting dbx or dbxtool and Loading Your Program

To start dbx, type the dbx command at a shell prompt:

$ dbx

To start dbxtool, type the dbxtool command at a shell prompt:

$ dbxtool

To start dbx and load the program to be debugged:

$ dbx program_name

To start dbxtool and load the program to be debugged:

$ dbxtool program_name

To start dbx and load a program that is a mixture of Java code and C JNI code or C++ JNI code:

$ dbx program_name{.class | .jar}

You can use the dbx command to start dbx and attach it to a running process by specifying the process ID.

$ dbx - process_id

You can use the dbxtool command to start dbxtool and attach it to a running process by specifying the process ID.

$ dbxtool - process_id

If you don’t know the process ID of the process, include the pgrep command in the dbx command to find and attach to the process. For example:

$ dbx - `pgrep Freeway`
Reading -
Reading ld.so.1
Reading libXm.so.4
Reading libgen.so.1
Reading libXt.so.4
Reading libX11.so.4
Reading libce.so.0
Reading libsocket.so.1
Reading libm.so.1
Reading libw.so.1
Reading libc.so.1
Reading libSM.so.6
Reading libICE.so.6
Reading libXext.so.0
Reading libnsl.so.1
Reading libdl.so.1
Reading libmp.so.2
Reading libc_psr.so.1
Attached to process 1855
stopped in _libc_poll at 0xfef9437c
0xfef9437c: _libc_poll+0x0004:   ta     0x8
Current function is main
   48   XtAppMainLoop(app_context);
(dbx)

For more information on the dbx command and start-up options, see dbx Command and the dbx(1) man page, or type dbx -h.

If you are already running dbx, you can load the program to be debugged, or switch from the program you are debugging to another program, with the debug command:

(dbx) debug program_name

To load or switch to a program that includes Java code and C JNI code or C++ JNI code:

(dbx> debug program_name{.class | .jar}

If you are already running dbx, you can also use the debug command to attach dbx to a running process:

(dbx) debug program_name process_id

To attach dbx to a running process that includes Java code and C JNI (Java Native Interface) code or C++ JNI code:

(dbx) debug program_name{.class | .jar} process_id

For more information on the debug command, see debug Command.