Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Running a Program

When you first load a program into dbx, dbx navigates to the program’s “main” block (main for C, C++, and Fortran 90; MAIN for Fortran 77; the main class for Java code). dbx waits for you to issue further commands, by navigating through code or using event management commands.

You can set breakpoints in the program before running it.


Note -  When debugging an application that is a mixture of Java code and C JNI (Java Native Interface) code or C++ JNI code, you might want to set breakpoints in code that has not yet been loaded. For more information, see Setting Breakpoints in Native (JNI) Code.

Use the run command to start program execution.

You can optionally add command-line arguments and redirection of input and output, using < for input and > or >> for output. Using >> will append contents to the existing output file.

(dbx) run [arguments][ < input-file] [ > output-file]

Note -  You cannot redirect the input and output of a Java application.

Note -  Output from the run command overwrites an existing file even if you have set noclobber for the shell in which you are running dbx, unless you used >>, in which case, the command appends to the existing file.

The run command without arguments restarts the program using the previous arguments and redirection. The rerun command restarts the program and clears the original arguments and redirection.