Prism 6.0 User's Guide

Tracing Program Execution

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.

Using the Event Table and the Events Menu

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.

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.

Deleting Traces via the Event Table

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".

Using Commands

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:

trace {print a}

trace at 17 if a .GT. 10

In addition, Prism interprets

trace line-number

as being the same as

trace at line-number

For Machine Instructions

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.

Deleting Traces via the Command Window

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".