ZBreak

The ZBREAK command sets or clears routine breakpoints during debugging.

The format of the ZBREAK command is:

ZB[REAK][:tvexpr] [-]entryref[:[expr][:intexpr]][,...]

When GT.M encounters the entryref, GT.M suspends execution of the routine code and XECUTEs the breakpoint action before executing any of the commands on the line. For more information on entryrefs, see Chapter 5: “General Language Features of M.

When the optional integer expression is used, GT.M activates the breakpoint on the intexpr-th time the process encounters the breakpoint during routine execution. Once GT.M activates the breakpoint, that breakpoint remains active for the process until explicitly replaced or removed, or until the process terminates.

For more information, refer to Chapter 4: “Operating and Debugging in Direct Mode.

Examples of ZBREAK

Example:

GTM>ZPRint ^ZBTEST
ZBTEST;
     Do SUB
     Quit
SUB  Write !,"This is ZBTEST"
     Quit
GTM>ZBREAK SUB^ZBTEST
GTM>Do ^ZBTEST
%GTM-I-BREAKZBA, Break instruction encountered during ZBREAK action
At M source location SUB^ZBTEST
GTM>ZSHOW "B"
SUB^ZBTEST

This inserts a ZBREAK with a default action at SUB^ZBTEST. After GT.M encounters the BREAK, the ZSHOW "B" displays this as the only ZBREAK in the image.

Example:

GTM>ZBREAK -*
                
GTM>ZGOTO
GTM>ZBREAK SUB^ZBTEST:"W !,""Trace"""
GTM>Do ^ZBTEST
Trace
This is ZBTEST
GTM>

This removes all existing ZBREAKs with a ZBREAK -*. Note that it is not necessary to remove ZBREAKs before modifying them. It also clears the process invocation stack with an argumentless ZGOTO. Then it uses a ZBREAK to insert a trace-point. Every time GT.M executes the line to where ZBREAK has established a trace-point, it performs the specified action without entering Direct Mode.

Example:

ZBreak PRINT^TIME::5

This BREAKs execution at line PRINT in routine just before the fifth time the line is executed.

Example:

ZBREAK PRINT^TIME:"WRITE AVE BREAK":3

This inserts a ZBREAK action of WRITE AVE and BREAK before the third execution of PRINT^TIME.