Question
· Jan 11, 2018

How to use zb to debug

Hi,

I want to monitor some variables in my program.

So I do this "zb *varname", however, i don't really want to get break went the program touch "varname" every time.

I only want to get break when certain conditions are meet. For example, $d(varname(1,2,3)) >  0, then break.

Is there any way to achieve this?

Thanks.

Discussion (2)1
Log in or sign up to continue

You want to use the condition parameter of zbreak. Take a look at this code:

zTestDebug
x(1,2,3) = -2
x(1,2,3) = 1
x(1,2,3) = 3

If I do the following with zbreak:

zb *x:"B":"$g(x(1,2,3))>0"

This just breaks if x(1,2,3) is greater than 0. Then execute the routine, this is what happens:

%SYS>d ^zTestDebug
 s x(1,2,3) = 1
 ^
<BREAK>zTestDebug+2^zTestDebug
%SYS 2d0>g
 s x(1,2,3) = 3
 ^
<BREAK>zTestDebug+3^zTestDebug
%SYS 2d0>g
%SYS>