$ESTACK does not contain method/routine executed as "If Method..." or "set var = Method..."
Only method/routine executed as "do Method..." is included into $ESTACK.
How can I modify a method or routine that returns a value so it can be included in $ESTACK?
Example upon executing via Studio Debug ($ESTACK is converted to string with ">" delimiter):
Expected: stackstr = %Debugger.System.DebugStub > LogGenerate > Entry > DirChain > Attributes > LogNew > LogSize > LogFormat > LogWrite
Processes DirChain, LogNew, LogSize, LogFormat are executed as "If Method..."
Process Attributes is executed as "set a = Attributes..."
Current: stackstr = %Debugger.System.DebugStub > LogGenerate > Entry > LogWrite
While process LogWrite is executed as "If LogWrite..." it is the last process in which I obtain $ESTACK
Thank you
Comments
To modify a method or routine that returns a value so it can be included in $ESTACK, you would need to ensure that the method or routine is executed using a DO command instead of assigning the result with SET or using an IF conditional. The $ESTACK special variable tracks call stack context frames created by commands like DO, XECUTE, or user-defined function calls. It does not include frames where methods are evaluated as expressions or assignments (e.g., SET var=Method() or IF Method()).
One approach to ensure proper inclusion within $ESTACK would be:
- Create a wrapper routine or method to call the target routine explicitly using
DO. - You might also examine usage of
NEWto manage context frames marked by$ESTACK[1][2].
Issuing commands like DO SubRoutine consistently ensures contexts are updated on $ESTACK as desired [1][2].
Sources: