[dtrace-discuss] putting a running app into trace mode

2009-08-28 Thread Joel Reymont
Suppose I have a USDT probe in Firefox and that I'm trying to catch the startup with a probe like this: proc:::exec-success /execname == firefox-bin/ { start = timestamp; } and stop tracing when Firefox hits this USDT probe: mozilla:::main-entry { exit(0); } How do I put the

Re: [dtrace-discuss] putting a running app into trace mode

2009-08-28 Thread Chad Mynhier
The system() action is printf()-like, so you could do something like this: proc:::exec-success / execname == firefox-bin / { stop(); system(%s -p %d, $1, pid); } and pass in the name of the 2nd script as the first argument. Chad On Fri, Aug 28, 2009 at 3:54 PM, Joel

Re: [dtrace-discuss] putting a running app into trace mode

2009-08-28 Thread Joel Reymont
On Aug 28, 2009, at 8:52 PM, Chad Mynhier wrote: proc:::exec-success / execname == firefox-bin / { stop(); system(/tmp/trace-firefox.d -p %d, pid); } All the examples I have seen hardcode /tmp/trace-firefox.d. How do I make it dynamic, though? For example, in dtrace -s 1.d -s

Re: [dtrace-discuss] putting a running app into trace mode

2009-08-28 Thread Chad Mynhier
On Fri, Aug 28, 2009 at 4:44 PM, Nicolas Williamsnicolas.willi...@sun.com wrote: On Fri, Aug 28, 2009 at 03:52:01PM -0400, Chad Mynhier wrote: You can do this with two separate DTrace invocations.  The first catches the exec of firefox-bin and fires off the second.  Something like this for the

Re: [dtrace-discuss] putting a running app into trace mode

2009-08-28 Thread Nicolas Williams
On Fri, Aug 28, 2009 at 05:13:41PM -0400, Chad Mynhier wrote: On Fri, Aug 28, 2009 at 4:44 PM, Nicolas Williamsnicolas.willi...@sun.com wrote: Don't forget to have a system(prun $pid); action in the BEGIN probe of the second script... Nope, DTrace will actually take care of that for you.

Re: [dtrace-discuss] putting a running app into trace mode

2009-08-28 Thread Adam Leventhal
Don't forget to have a system(prun $pid); action in the BEGIN probe of the second script... Nope, DTrace will actually take care of that for you. Consider this script, /tmp/foo.d: Is this new? It's very nice... Thanks, I believe it's an accidental feature that has been there

Re: [dtrace-discuss] putting a running app into trace mode

2009-08-28 Thread Joel Reymont
On Aug 28, 2009, at 11:36 PM, Adam Leventhal wrote: I believe it's an accidental feature that has been there forever. FYI, it doesn't work this way on the Mac. I have to 'kill -CONT $target' from the 1st script in my pipeline, otherwise I have to 'fg' in ther terminal window where I

Re: [dtrace-discuss] putting a running app into trace mode

2009-08-28 Thread Joel Reymont
I used to be able to stop tracing Safari once NSApplicationMain was entered. This was with 'dtrace -c...'. I'm no longer able to do so with exec-success, stop and attaching to the stopped process, e.g. ./d Safari startup.d stop-nsapp.d where startup.d: BEGIN { start = timestamp; } END {