To execute a program, you must first load it, as described in " Loading a Program". Once you start the program running, you can step through it, and interrupt and continue execution.
See " Loading a Program" for information on executing a program in MP Prism.
To run a program:
From the menu bar - If you have no command-line arguments you want to specify, choose the Run selection from the Execute menu; execution starts immediately. (The Run selection by default is in the tear-off region.)
If you have command-line arguments, choose the Run (args) selection from the Execute menu. A dialog box is displayed, in which you can specify any command-line arguments for the program; see Figure 3-2. If you have more arguments than fit in the input box, they scroll to the left. Click on the Run button to start execution.
From the command window - Issue the run command, including any arguments to the program on the command line. You can abbreviate the command to r. If you have already run the program, you can issue the rerun command to run it again, using the same argument list you previously passed to the program. In both cases, you can redirect input or output using < or > in the standard Solaris manner.
When the program starts executing, the status region displays the message running.
You can continue to interact with Prism while a program is running, but many features will be unavailable. Unavailable selections are grayed out in menus. If you issue a command that cannot be executed while the program is running, it is queued until the program stops.
Prism by default creates a new window for a program's I/O. This window persists across multiple executions and program loads, giving you a complete history of your program's input and output. If you prefer, you can display I/O in the Xterm from which you invoked Prism; see " Resources".
You must begin execution by choosing Run or Run (args) (or issuing run from the command line). If execution stops before the program finishes (for example, because you have set a breakpoint), you can then step through the program, as described in this section. To step through the entire program, set a breakpoint at the first executable line, and then run to it. (See " Setting Breakpoints" for information on setting breakpoints.)
From the menu bar:
Choose the Step selection from the Execute menu to execute the next line of the program. (It is by default in the tear-off region.) Step steps into any functions called on that line.
Choose the Next selection from the Execute menu to execute the next statement of the program. (It is also by default in the tear-off region.) Next steps over any function called in the line, considering the function to be a single statement.
Choose the Stepout selection from the Execute menu to execute the current function, then return to its caller.
The execution pointer moves to indicate the next line to be executed.
From the command window:
Issue the step, next, or stepout command from the command line to perform the same action as the equivalent menu-bar selection; return is a synonym for stepout. In addition, you can specify the number of lines to be executed as an argument to step and next, and you can specify as an argument to stepout the number of levels of the call stack that you want to step out.
The stepi and nexti commands are also available for stepping by machine instruction. The address and instruction are displayed in the command window.
If execution takes considerable time--for example, because Next calls a long-running function--the status changes to running. You can use Prism, but many commands will be unavailable. Unavailable selections are grayed out in menus.
To interrupt execution, choose Interrupt from the Execute menu or type Control-c. The status changes to interrupted, and the source window updates to show the point at which execution stopped.
To continue execution after a program has been interrupted, choose Continue from the Execute menu, or issue the cont command from the command line. (Or you can step through the program, as described above.)
Continue and Interrupt are available by default in the tear-off region.
Prism displays the status messages before, during, and after the execution of a program, as listed in Table 3-1.
Table 3-1 Status Messages
Message |
Meaning |
---|---|
error |
Prism has encountered an internal error. |
connected |
Prism has connected to other nodes to work on a message-passing program. |
connecting |
Prism is connecting to other nodes in order to work on a message-passing program. |
initial |
Prism is starting up without a program loaded. |
interrupted |
The program has been interrupted. |
loading |
Prism is loading a program. |
not started |
The program is loaded but not yet started. |
running |
The program is running. |
stopped |
The program has stopped at a breakpoint or signal. |
terminated |
The program has run to completion and the process has gone away. |