Fancy ZSTEP GTM: Difference between revisions
From VistApedia
Jump to navigationJump to search
Created page with "General procedure: # Put a breakpoint on the code you want to debug: ZB UPDATE^DIE # Set special ZSTEP # Execute the code you want to debug: S FDA(3.1,"?+1,",.01)="BOO" D UPDA..." |
(No difference)
|
Revision as of 17:18, 28 January 2019
General procedure:
- Put a breakpoint on the code you want to debug: ZB UPDATE^DIE
- Set special ZSTEP
- Execute the code you want to debug: S FDA(3.1,"?+1,",.01)="BOO" D UPDATE^DIE(,$NA(FDA))
- Once you hit the breakpoint, type ZSTEP INTO to activate stepping. The entire routine execution will be shown.
Regular ZSTEP (save dev and restore dev after each line)
n oldio s oldio=$i u 0 w $t(@$zpos),! b u oldio
Detect if a variable has changed (in this case, $data of DIC(0)):
b:($g(olddic)'=$d(DIC(0))) s olddic=$d(DIC(0)) zstep into
Print source code while executing
S $ZSTEP="W $ZPOS,?20,$T(@$ZPOS),! ZSTEP INTO"
You can combine these together, for example, to print all executed lines and stop when a variable changes. Here's how I did that:
n oldio s oldio=$i u 0 b:($g(olddic)'=$d(DIC(0))) s olddic=$d(DIC(0)) zp @$zpos u oldio zstep into