Sun Studio 12: Debugging a Program With dbx

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; you can navigate through code or use event management commands.

You can set breakpoints in the program before running it.

Note –

When debugging an application that is a mixture of JavaTM code and C JNI (Java Native Interface) code or C++ JNI code, you may want to set breakpoints in code that has not yet been loaded. For information on setting breakpoints on such code, see Setting Breakpoints on Code That Has Not Yet Been Loaded by the JVM Software .

Use the run command to start program execution.

To run a program in dbx without arguments, type:

(dbx) run

You can optionally add command-line arguments and redirection of input and output.

(dbx) run [arguments][ < input_file] [ > output_file]

Note –

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

Output from the run command overwrites an existing file even if you have set noclobber for the shell in which you are running dbx.

The run command without arguments restarts the program using the previous arguments and redirection. For more information, see run Command. The rerun command restarts the program and clears the original arguments and redirection. For more information, see rerun Command.