In my debugger, I have a way to display the stack. But I am finding that there is more than one way, and sometimes they are not in sync.
For example, if I do ZSHOW "S":ZZ and then cycle through ZZ to get the information, I currently get this:
zz
}~S
}~1 = " Indirection"
}~2 = HndlMCode+16^TMGIDE2C
}~3 = HndlMCode+12^TMGIDE2C
}~4 = CMDPROMPT+40^TMGIDE2A
}~5 = CMDPROMPT+8^TMGIDE2A
}~6 = SP1+5^TMGIDE2
}~7 = main^TMGTEST
}~8 = " Indirection"
}~9 = PL2+46^TMGIDE
}~10 = PL2+43^TMGIDE
}~11 = M2+7^TMGIDE
}~12 = "+1^GTM$DMOD (Direct mode) "
This view has the most recent code at position #1. #7 is where I pause in the debugger just after starting main^TMGTESET. Entries 1-6 are from inside my debugger.
But if I loop through entries in $STACK() using this code
. NEW % FOR %=0:1:$STACK DO
. . W (%+1),". ",$STACK(%)," -- ",$STACK(%,"PLACE"),": ",$STACK(%,"MCODE")," ",$STACK(%,"ECODE"),!
I get this. This view has most recent code at highest number, those sometimes the end of the list has empty entries.
1. -dir -- +1^GTM$DMOD:
2. DO -- M2+7^TMGIDE: DO PROMPTLAUNCH("AllInOne") ;"<--- this is where debugged program is run.
3. DO -- PL2+43^TMGIDE: DO
4. DO -- PL2+46^TMGIDE: . XECUTE tmgDbgLine ;"<---- this launches the users mumps command
5. XECUTE -- @: DO T4^TMGTEST
6. DO -- T4+1^TMGTEST: SET A=1/0 ,M9,Z150373210,
7. -- :
8. -- :
9. -- :
10. -- :
11. -- :
----- Press Key To Continue -----
Notice that entry #5 is NOT the code I am currently running. It was from a former test. I have completed that test, returned to direct mode, and even typed ZGOTO, which I thought reset the stack etc before running more code. I even entered KILL from the direct mode ydb prompt to clear the variable table. I then went back into the debugger, lanched main^TMGTEST, but STILL the $STACK() shows do T4^TMGTEST.
Why is $STACK() not synchronized with ZSHOW "S" ??
Thanks
Kevin