YottaDB / YDB

Mirrored from https://gitlab.com/YottaDB/DB/YDB
Other
76 stars 37 forks source link

ZSTEP OVER and ZSTEP OUTOF work correctly across extrinsic function returns using QUIT @ syntax #141

Closed nars1 closed 6 years ago

nars1 commented 6 years ago

Final Release Note

ZSTEP OVER and ZSTEP OUTOF work correctly across extrinsic function calls which return using the QUIT @ syntax. Previously, the ZSTEP would not pause (and execute the ZSTEP action) after the return from such function calls. (YDB#141)

Description

Below is an example that illustrates the ZSTEP OVER issue.

> cat zstover1.m
        do ^zstepover
        set x1=$$y
        quit
y()
        set x2=""
        quit x2

> cat zstepover.m
        set $zstep="write:$x ! write $zpos,?30,"":"" zprint @$zpos zstep  "
        zb +3:"zstep into"
        write !,"Stepping STARTED",!

First a case that works (without the @ usage).

> mumps -run zstover1

Stepping STARTED
+2^zstover1                   : set x1=$$y
+3^zstover1                   : quit

$ZSTEP is defined to print each M line as it gets executed (starting from +2^zstover1). The line "set x1=$$y" does get printed. And since this is a ZSTEP OVER usage, lines executed inside the $$y call do not get printed but the M line executed after returning from $$y does get printed (+3^zstover1). This is the correct behavior.

But if the above example is slightly modified so the quit (at y+2^zstover1) is replaced with a quit @ syntax, things no longer work. Below is the revised example.

> cat zstover2.m
        do ^zstepover
        set x1=$$y
        quit
y()
        set xx="x2",x2=""
        quit @xx

> mumps -run zstover2

Stepping STARTED
+2^zstover2                   : set x1=$$y

Notice the missing +3^zstover2 line.

And below is an example that illustrates a similar issue with ZSTEP OUTOF.

> cat zstoutof1.m
x       ;
        set x1=$$helper
        quit

helper();
        do ^zstepoutof
        set x2=$$y
        quit x2

y()
        set xx="x3",x3=""
        quit @xx

> cat zstepoutof.m
        set $zstep="write:$x ! write $zpos,?30,"":"" zprint @$zpos zstep outof"
        zb +3:"zstep into"
        write !,"Stepping STARTED",!

> cat zstoutof2.m
x       ;
        set x1=$$helper
        quit

helper();
        do ^zstepoutof
        set x2=$$y
        set xx="x2"
        quit @xx

y()
        set xx="x3",x3=""
        quit @xx

> mumps -run zstoutof1

Stepping STARTED
helper+2^zstoutof1            : set x2=$$y
x+2^zstoutof1                 : quit

> mumps -run zstoutof2

Stepping STARTED
helper+2^zstoutof2            : set x2=$$y

zstoutof2 does not work correctly (does not display x+2^zstoutof2) like zstoutof1 does.

Draft Release Note

ZSTEP OVER and ZSTEP OUTOF work correctly even across extrinsic function calls which return using the QUIT @ syntax. Previously, the ZSTEP would not pause (and execute the ZSTEP action) after the return from such function calls.