Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Starting dbx or dbxtool and Loading Your Program

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

$ dbx

To start dbxtool, type the dbxtool command in 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 about the dbx command and startup 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, see debug Command.