Discussion
· Mar 18

Headless debugging - stack info

How do you collect stack info when debugging non-interactive jobs?

I cobbled this together today from the docs, but maybe there's something pre-built? LOG^%ETN()?

set stack = ""
for loop=0:1:$STACK(-1) { 
      set stack = stack _ "Context level:" _ loop _ " Context type: " _ $STACK(loop) _ $c(10,13) _
                          "  Current place: " _ $STACK(loop,"PLACE") _ $c(10,13) _
                          "  Current source: " _$STACK(loop,"MCODE") _ $c(10,13)
}

Log meth

Discussion (6)4
Log in or sign up to continue

Take a look at class %SYS.ProcessQuery

USER>set q=##class(%SYS.ProcessQuery).ExamStackByPid($J,1)

USER>zw ^mtemp(q)
^mtemp(4,"*FORMAT")=1
^mtemp(4,"*LEVEL",1)=1
^mtemp(4,"*LEVEL",2)=2
^mtemp(4,"*STACK")=2
^mtemp(4,"*STACK",0,"V","$D")=""
...
^mtemp(4,"*STACK",1,"I")="1^S^^^0^"
^mtemp(4,"*STACK",1,"L")="  1   SIGN ON                            "
^mtemp(4,"*STACK",1,"S")=""
^mtemp(4,"*STACK",1,"T")="SIGN ON                           "
^mtemp(4,"*STACK",2,"I")="2^e^^^0^S q=##CLASS(%SYS.ProcessQuery).ExamStackByPid($J,1)"
^mtemp(4,"*STACK",2,"L")="  2   $$EXTFUNC                          ~S q=##CLASS(%SYS.ProcessQuery).ExamStackByPid($J,1)"
^mtemp(4,"*STACK",2,"S")="~S q=##CLASS(%SYS.ProcessQuery).ExamStackByPid($J,1)"
^mtemp(4,"*STACK",2,"T")="$$EXTFUNC                         "
^mtemp(4,"*VARS")=1