You can trace program execution by using the Event Table or Events menu, or by issuing commands. All methods add an event to the Event Table. If you trace a source line, Prism displays a T next to the line in the line-number region.
As described earlier, tracing is essentially the same as setting a breakpoint, except that execution continues automatically after the breakpoint is reached. When tracing source lines, Prism steps into procedures if they were compiled with the -g option; otherwise it steps over them as if it had issued a next command.
To trace program execution, choose the Trace, Trace <loc>, or Trace <var> selection from the Events menu. These choices are also available as Common Events buttons within the Event Table itself.
Trace <loc> prompts for a source line. Prism displays a message immediately prior to the execution of this source line.
Trace <var> prompts for a variable name. A message is printed when the variable's value changes. The variable can be an array, an array section, or a parallel variable, in which case a message is printed any time any element changes. This slows execution considerably.
In addition, Trace <cond> is available as a Common Events button. It prompts for a condition, which can be any expression that evaluates to true or false; see " Writing Expressions in Prism" for more information on writing expressions. The program displays a message when the condition is met. This also slows execution considerably.
For variations of these traces, you can create your own event in the Event Table. You can also use the Actions field to specify Prism commands that are to be executed along with the trace.
To delete a trace, choose the Delete selection from the Events menu, or use the Delete button in the Event Table. See " Deleting an Existing Event".
Issue the trace command from the command line to trace program execution. Issuing trace with no arguments causes each source line in the program to be displayed in the command window before it is executed.
The trace command uses the same syntax as the stop command; see " Using Commands". For example:
To trace and print a on every source line:
trace {print a}
To trace line 17 if a is greater than 10:
trace at 17 if a .GT. 10
In addition, Prism interprets
trace line-number
as being the same as
trace at line-number
To trace machine instructions, use the tracei command, specifying a machine address. When tracing machine instructions, Prism follows all procedure calls down. The tracei command has the same syntax as the stop command; see " Using Commands".
The history region displays the address and the machine instruction. The execution pointer moves to the next source line to be executed.
To delete a trace, use the show events command to obtain the ID associated with the trace, then issue the delete command with the ID as its argument. See " Using Commands".