#!/usr/sbin/dtrace -s
/* Based on Python example from http://blogs.sun.com/levon/entry/python_and_dtrace_in_build. 
 * David Leadbeater, 2011. */

#pragma D option quiet

dtrace:::BEGIN {
  depth = 0
}

perl$target:::sub-entry, perl$target:::sub-return
{
  depth += probename == "sub-entry" ? 0 : -1;

  printf("%*s %s %s (%s:%d)\n", depth, "", probename == "sub-entry" ? "->" : "<-",
      copyinstr(arg0), copyinstr(arg1), arg2);
  depth += probename == "sub-entry" ? 1 : 0;
}

