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.

  • 0
  • 48
  • 0
  • 2

Answers

zb *varname::"$d(varname(1,2,3,))>0"

 

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>