when

The when command sets complex breakpoints

Format

The format for the when command is:

when condition action

where:

condition Specifies the conditions under which the breakpoint will occur.
action Specifies the action to be taken when the breakpoint occurs.

Functional Description

The when command provides a very flexible way to set breakpoints and to specify the action that should be taken when they are encountered.

Each when command takes two arguments, a condition, and an action. The condition can be something as simple as @pc==main (when the program counter is equal to value of the symbol main), or it can be a complex expression that might include specifying the contents of memory locations.

Actions can be any Monitor command string. But it can also include the pseudo command stop. For example, the command, "when @pc==main stop" specifies that when the program counter has the value of the symbol main, execution should stop.

Conditional expressions can be combined in any arbitrary manner to provide extremely complex breakpoint conditions. For example,

	PMON> when @pc==main2&&(^tcbchn==task1||^tcbchn==task2) stop

which will stop execution when the pc is equal to main2, and either tcbchn is equal to task1 or task2.

In the preceeding examples we have chosen to stop execution when the condition is met. However, it is possible to specify a list of commands. For example,

	PMON> when @pc==sort "r;d -w dat3 1"

specifes that when the pc is equal to 'sort', the commands 'r' and 'd -w dat3 1' will be executed. The ';' is used to separate commands, and the double quotes are necessary because the argument contains spaces.

The Monitor is responsible for deciding when to use hardware breakpoint registers (if present). In general, the Monitor uses software breakpoints unless there is a specific reason that a hardware breakpoint is required.

If you issue a command that requires a hardware breakpoint register. But that the Monitor finds that there is not one available. The Monitor will automatically use trace mode when you issue the c command to continue execution. Because trace mode is not real-time, the Monitor will warn you at the time that you set the breakpoint that this will require non real-time execution.

Examples

See Also

b, db, and load commands.


Navigation: Document Home | Document Contents | Document Index