A typical approach to debugging is to stop the execution of a program at different points so that you can perform various actions--for example, check the values of variables. You stop execution by setting a breakpoint. If you perform a trace, execution stops, then automatically continues.
Breakpoints and traces are events. You can specify before the execution of a program begins what events are to take place during execution. When an event occurs:
The execution pointer moves to the current execution point.
A message is printed in the command window.
If you specified that an action was to accompany the event (for example, the printing of a variable's value), it is performed.
If the event is a trace, execution then continues. If it is a breakpoint, execution does not resume until you explicitly order it to (for example, by choosing Continue from the Execute menu).
Prism provides various ways of creating these events--for example, by issuing commands, or by using the mouse in the source window. " Setting Breakpoints" describes how to create breakpoint events; " Tracing Program Execution" describes how to create trace events. " Using the Event Table" describes the Event Table, which provides a unified method for listing, creating, editing, and deleting events.
See " Events Taking Pset Qualifiers (MP Prism Only)" for a discussion of events in MP Prism.
You can define events so that they occur:
When the program reaches a certain point in its execution - For example, at a specified line or function.
When the value of a variable changes - For example, you can define an event that tells Prism to stop the program when x changes value. This kind of event is sometimes referred to as a watchpoint. It slows execution considerably, since Prism has to check the value of the variable after each statement is executed.
At every line or assembly-language instruction.
Whenever a program is stopped - For example, you can define an event that tells Prism to print the value of x whenever the program stops.
Such events are referred to as triggering conditions.
In addition, you can qualify an event as follows:
So that it occurs only if a specified condition is met - For example, you can tell Prism to stop at line 25 if x is not equal to 1. Like watchpoints, this kind of event slows execution.
So that it occurs only after its triggering condition has been met a specified number of times - For example, you can tell Prism to stop the tenth time that the program reaches the function foo.
You can include one or more Prism commands as actions that are to take place as part of the event. For example, using Prism commands, you can define an event that tells Prism to stop at line 25, print the value of x, and do a stack trace.