Obtaining Traceback Information
It is sometimes useful for a procedure or function to obtain information about its caller(s). The SCOPE_TRACEBACK function returns a string array describing the contents of the procedure stack. The first element of the resulting array contains information for the IDL main program ($MAIN$). Each subsequent element contains information for the next routine in the call stack. The final element contains the information for the currently running routine. Each element of this array contains the module name, source filename, and line number of the routine it describes.
For example, the following code fragment prints the name of its caller, followed by the source filename and line number of the call:
A = SCOPE_TRACEBACK() ; Print next to last element: caller of the current routine PRINT, 'Called from: ', A[N_ELEMENTS(A)-2]
This results in a message of the following form:
SCOPE_TRACEBACK can also provide more detailed information for the call stack. See "SCOPE_TRACEBACK" (IDL Reference Guide) for more information about the function's capabilities.
In the IDL Workbench, you can visually inspect the call stack using the Debug view.