Tcl - DTracing Tcl Programs

  These scripts trace activity of the Tcl programming language, making use
  of the Tcl DTrace provider which was integrated into the Tcl source in
  version tcl8.4.16. See the Tcl DTrace wiki page for details:

       http://wiki.tcl.tk/19923

  This provider was written by Daniel Steffen and is currently available
  by downloading and compiling the Tcl source with the --enable-dtrace
  option to configure.

  Since the DTrace Tcl provider could be developed a little further, there is
  a chance that it has changed slightly by the time you are reading this,
  causing these scripts to either break or behave oddly. Firstly, check for
  newer versions of the DTraceToolkit; if it hasn't been updated and you need
  to use these scripts immediately, then updating them shouldn't take
  too long. The following was the state of the provider when these scripts
  were written - check for changes and update the scripts accordingly,

       provider tcl {
           probe proc-entry(procname, argc, argv);
           probe proc-return(procname, retcode);
           probe proc-result(procname, retcode, retval, retobj);
           probe proc-args(procname, args, ...);
           probe cmd-entry(cmdname, argc, argv);
           probe cmd-return(cmdname, retval);
           probe cmd-args(procname, args, ...);
           probe inst-start(instname, depth, stackobj);
           probe inst-done(instname, depth, stackobj);
           probe obj-create(object);
           probe obj-free(object);
           proobe tcl-probe(strings, ...);
       };

  Update: it looks like two new probes have recently been added to the
  provider: proc-info and cmd-info. I'll need to update these scripts to
  make use of these new probes.