Issue the command stop (or when, which is an alias for stop) from the command line to set a breakpoint. The syntax of the stop command is also used by the stopi, trace, and tracei commands, which are discussed below. The general syntax for all the commands is:
command [variable | at line | in func] [if expr] [{cmd[; cmd...]}] [after n]
where
command - As mentioned above, can be stop, stopi, when, trace, or tracei.
variable - Is the name of a variable. The command is executed (in other words, the event takes place) if the value of the variable changes. If the variable is an array, an array section, or a parallel variable, the command is executed if the value of any element changes. This form of the command slows execution considerably. You cannot specify both a variable and a program location.
line - Specifies the line number where the stop or trace is to be executed. If the line is not in the current file, use the format:
at "filename":line-number
func - Is the name of the function or procedure in which the stop or trace is to be executed.
expr - Is any language expression that evaluates to true or false. This argument specifies the logical condition, if any, under which the stop or trace is to be executed. For example,
if a .GT. 1
This form of the command slows execution considerably, unless you combine it with the at line syntax. See " Writing Expressions in Prism" for more information on writing expressions in Prism.
cmd - Is any Prism command (except attach, core, detach, load, return, run, or step). This argument specifies the actions, if any, that are to accompany the execution of the stop or trace. For example, {print a} prints the value of a. If you include multiple commands, separate them with semicolons.
n - Is an integer that specifies how many times a triggering condition is to be reached before the stop or trace is executed; see " Overview of Events" for a discussion of triggering conditions. This is referred to as an after count. The default is 1. Once the stop or trace is executed, the count is reset to its original value. Note that if there is both a condition and an after count, the condition is checked first.
The first option listed (specifying the location or the name of the variable) must come first on the command line; the other options, if you include them, can be in any order.
For the when command, you can use the keyword stopped to specify that the actions are to occur whenever the program stops execution.
When you issue the command, an event is added to the event list. If the command sets a breakpoint at a program location, a B appears in the line-number region next to the location.
To stop execution the tenth time in function foo and print a:
stop in foo {print a} after 10
To stop at line 17 of file bar if a is equal to 0:
stop at "bar":17 if a == 0
To stop whenever a changes:
stop a
To stop the third time a equals 5:
stop if a .eq. 5 after 3
To print a and do a stack trace every time the program stops execution:
when stopped {print a; where}
To set a breakpoint at a machine instruction, issue the stopi command, using the syntax described above, and specifying a machine address. For example,
stopi at 0x1000
stops execution at address 1000 (hex).
The history region displays the address and the machine instruction. The source pointer moves to the source line being executed.
To delete a breakpoint via the command window, first issue the show events command. This prints out the event list. Each event has an ID number associated with it.
To delete one or more of these events, issue the delete command, listing the ID numbers of the events you want to delete; separate multiple IDs with one or more blank spaces. For example,
delete 1 3
deletes the events with IDs 1 and 3. Use the argument all to delete all existing events.