Thanks, Robert. It is available in 2017, but I was not able to set it up yet. Something is still wrong the way I run it, please see below. I start debugging, stop at a breakpoint and input the $J value.
%SYS>D DIR^TRACE()
%SYS>D ^TRACE
TRACE utility for Cache. You can signal a process to write a record of all
procedure, function, or subroutine calls to a file. Then use this utility to
interpret and display the trace. The trace file is named: CacheTrace_'pid'.txt
Use $$DIR^TRACE(dir) to set the directory where the file(s) should be written
(process must have create/write access to the directory). $$DIR^TRACE() returns
the current directory for trace files.
Use $$ON^TRACE(pid) to start the trace and $$OFF^TRACE(pid) to end the
recording. Then just run ^TRACE to see the results.
Process ID for trace file: 5352
Output to: <0> TestAG.txt
Processing file ...
-1,Unable to open file CacheTrace_5352.txt
%SYS>
Thanks, Stuart. Correct me if I am wrong but I would need to install such a function in multiple places and that's exactly what I am trying to avoid. I did use $STACK in less involved situations before and it is very useful in its own right.
It is very verbose but yes, I got it working now too. Thanks, Robert! It is interesting that the resultant file lists only routine names but not the labels. Instead of a label name, it lists the label line number.