I had this exact issue years ago at TP, I wrote a routine I called spy, it would do a port.status with a layer.stack and locate the last program in use, if it was a standard sub-routine it would get the calling main program, then it would vlist the program and out put the source code line, you also had the option to view the code around it, don't think I've still got the code but I'll have a look round.