title: How to trace a program from its very beginning without running it as root
body: <p>I'm writing a tool that calls through to DTrace to trace the program that the user specifies.</p>
  
  <p>If my tool uses dtrace -c to run the program as a subprocess of DTrace, not only can I not pass any arguments to the program, but the program runs with all the privileges of DTrace—that is, as root (I'm on Mac OS X). This makes certain things that should work break, and obviously makes a great many things that shouldn't work possible.</p>
  
  <p>The other solution I know of is to start the program myself, pause it by sending it <code>SIGSTOP</code>, pass its PID to <code>dtrace -p</code>, then continue it by sending it <code>SIGCONT</code>. The problem is that either the program runs for a few seconds without being traced while DTrace gathers the symbol information or, if I sleep for a few seconds before continuing the process, DTrace complains that <code>objc&lt;pid&gt;:&lt;class&gt;:&lt;method&gt;:entry</code> matches no probes.</p>
  
  <p>Is there a way that I can run the program under the user's account, not as root, but still have DTrace able to trace it from the beginning?</p>