$STACK() incorrect.
$STACK is not updated properly.
Steps taken to replicate this problem: I have mumps code in TMGTEST.m The relevant parts are this.
T2 ;
WRITE "HELLO",!
T2B NEW KT SET KT=$$T3("WORLD")
T2C QUIT
;
T3(A) ; WRITE $GET(A),!
QUIT 1
;
T4 ;
SET A=1/0
QUIT ;
I ran this test immediately after starting ydb. Comments below will be marked with ***
Entering YottaDB system now...
yottadb>F I=-1:1:$STACK W I,". ",$STACK(I)," -- ",$STACK(I,"PLACE"),": ",$STACK(I,"MCODE")," ",$STACK(I,"ECOD
-1. 0 -- :
0. -dir -- +1^GTM$DMOD:
*** Above is before anything has run, showing that stack is at 0
yottadb>DO T4^TMGTEST
%YDB-E-DIVZERO, Attempt to divide by zero
At M source location T4+1^TMGTEST
*** Above I have run code to generate an error, returning me to direct mode
yottadb>F I=-1:1:$STACK W I,". ",$STACK(I)," -- ",$STACK(I,"PLACE"),": ",$STACK(I,"MCODE")," ",$STACK(I,"ECOD
E"),!
-1. 1 -- :
0. -dir -- +1^GTM$DMOD:
1. DO -- T4+1^TMGTEST: SET A=1/0 ,M9,Z150373210,
*** Above we see appropriate stack, showing error created by division by zero
yottadb>ZGOTO
yottadb>F I=-1:1:$STACK W I,". ",$STACK(I)," -- ",$STACK(I,"PLACE"),": ",$STACK(I,"MCODE")," ",$STACK(I,"ECOD
E"),!
-1. 1 -- :
0. -dir -- +1^GTM$DMOD:
*** After entering ZGOTO, stack is again reported correctly.
yottadb>ZBREAK T2B^TMGTEST
*** Above we set a ZBREAK for the other part of the test code that should NOT create any errors.
yottadb>DO T2^TMGTEST
HELLO
%YDB-I-BREAKZBA, Break instruction encountered during ZBREAK action
At M source location T2B^TMGTEST
*** Above we see that the code has run and stopped on T2B^TMGTEST, as expected.
yottadb>F I=-1:1:$STACK W I,". ",$STACK(I)," -- ",$STACK(I,"PLACE"),": ",$STACK(I,"MCODE")," ",$STACK(I,"ECOD
E"),!
-1. 1 -- :
0. -dir -- +1^GTM$DMOD:
1. DO -- T4+1^TMGTEST: SET A=1/0 ,M9,Z150373210,
*** Here is where the issue is. $STACK is showing information about a PRIOR RUN,
the one that generated an error. Not showing execution into T2^TMGTEST.
yottadb>ZSHOW "S"
T2B^TMGTEST (ZBREAK)
(Direct mode)
+1^GTM$DMOD (Direct mode)
*** Above I show that ZSHOW "S" is empty. I am not sure if that is expected after a ZBREAK or not.
But it is different from that shown by $STACK()
Entering YottaDB system now...
yottadb>F I=-1:1:$STACK W I,". ",$STACK(I)," -- ",$STACK(I,"PLACE"),": ",$STACK(I,"MCODE")," ",$STACK(I,"ECOD
-1. 0 -- :
0. -dir -- +1^GTM$DMOD:
*** Above is before anything has run, showing that stack is at 0
yottadb>DO T4^TMGTEST
%YDB-E-DIVZERO, Attempt to divide by zero
At M source location T4+1^TMGTEST
*** Above I have run code to generate an error, returning me to direct mode
yottadb>F I=-1:1:$STACK W I,". ",$STACK(I)," -- ",$STACK(I,"PLACE"),": ",$STACK(I,"MCODE")," ",$STACK(I,"ECOD
E"),!
-1. 1 -- :
0. -dir -- +1^GTM$DMOD:
1. DO -- T4+1^TMGTEST: SET A=1/0 ,M9,Z150373210,
*** Above we see appropriate stack, showing error created by division by zero
yottadb>ZGOTO
yottadb>F I=-1:1:$STACK W I,". ",$STACK(I)," -- ",$STACK(I,"PLACE"),": ",$STACK(I,"MCODE")," ",$STACK(I,"ECOD
E"),!
-1. 1 -- :
0. -dir -- +1^GTM$DMOD:
*** After entering ZGOTO, stack is again reported correctly.
yottadb>ZBREAK T2B^TMGTEST
*** Above we set a ZBREAK for the other part of the test code that should NOT create any errors.
yottadb>DO T2^TMGTEST
HELLO
%YDB-I-BREAKZBA, Break instruction encountered during ZBREAK action
At M source location T2B^TMGTEST
*** Above we see that the code has run and stopped on T2B^TMGTEST, as expected.
yottadb>F I=-1:1:$STACK W I,". ",$STACK(I)," -- ",$STACK(I,"PLACE"),": ",$STACK(I,"MCODE")," ",$STACK(I,"ECOD
E"),!
-1. 1 -- :
0. -dir -- +1^GTM$DMOD:
1. DO -- T4+1^TMGTEST: SET A=1/0 ,M9,Z150373210,
*** Here is where the issue is. $STACK is showing information about a PRIOR RUN,
the one that generated an error. Not showing execution into T2^TMGTEST.
yottadb>ZSHOW "S"
T2B^TMGTEST (ZBREAK)
(Direct mode)
+1^GTM$DMOD (Direct mode)
*** Above I show that ZSHOW "S" is empty. I am not sure if that is expected after a ZBREAK or not.
But it is different from that shown by $STACK()
yottadb>w $ZVER GT.M V7.0-005 Linux x86_64
yottadb>w $ZYRELEASE YottaDB r2.02 Linux x86_64
Thanks, Kevin Toppenberg
Edited by Kevin Toppenberg