You can attach to a running GT.M process by using the gtm_zinterrupt environment variable to invoke Serenji.
Ensure that the process that you want to be able to attach to has gtm_zinterrupt set as follows:
export gtm_zinterrupt='IF $$ENABLE^%SerenjD("nn.nn.nn.nn",,,"-0")'
or with your m code:
set $zinterrupt="IF $$ENABLE^%SerenjD(""nn.nn.nn.nn"",,,""-0"")'
where nn.nn.nn.nn is the IP address of the machine where you have the Serenji client installed. Make sure you have the Serenji Sentry running in the taskbar notification area of your desktop as this listens for the connection from your process.
Then when you want to attach to the process issue the command:
mupip intrpt <pid>
where <pid> is the process id of the process you want to attach to.
This will cause your process to break wherever it happens to be and connect to the Serenji client. From there you can examine your process and step through the code.
You can call $$ENABLE^%SerenjD() directly from any process if you want to use some other signalling mechanism to trigger debugging rather than using gtm_zinterrupt. Consult the source code in file _SerenjD.m for more documentation about the arguments to $$ENABLE.
George James Software
PO Box 701, Weybridge, KT13 3GZ, UK
0793 032 0241 / 01932-252568