Discussion:
Question about DTrace process control
Rui Paulo
2010-07-05 12:51:46 UTC
Permalink
Hi,
I'm trying to follow the process creation code path from DTrace but something is missing:

First dtrace(1) calls:
dtrace_proc_create()
dt_proc_create()
Pcreate()
dt_proc_create_thread()
pthread_create(..., dt_proc_control)

dt_proc_control() sets the child running and expects all the rtld breakpoints to hit and also the main() breakpoint.

Then dtrace(1) expects the childs to be stopped after returning from dtrace_proc_create() and calls dtrace_proc_continue().

What I'm missing is how this can happen since dt_proc_control() has a loop calling Psetrun(), which, according to my understanding, would set the child running until it died (and that's what's happening in FreeBSD).

On a related note, I noticed that running 'dtrace -c ls' on Solaris produces 'dtrace: no probes specified' (because dtrace(1) never calls dtrace_proc_continue()), but on Mac OS X, 'dtrace -c ls' effectively runs ls(1) and then prints 'dtrace: no probes specified'.

Any ideas?

Thanks,
--
Rui Paulo
Adam Leventhal
2010-07-07 20:48:50 UTC
Permalink
Hey Rui,
From dt_proc_bpmatch() we call the breakpoint handler routines that can invoke dt_proc_stop(). This will wait for main() in dtrace.c to invoke dtrace_proc_continue().
Does that answer your question?

The difference between Mac OS X and Solaris is that I believe we fixed that bug in Solaris. I don't have the ID handy.

Adam
Hi,
dtrace_proc_create()
dt_proc_create()
Pcreate()
dt_proc_create_thread()
pthread_create(..., dt_proc_control)
dt_proc_control() sets the child running and expects all the rtld breakpoints to hit and also the main() breakpoint.
Then dtrace(1) expects the childs to be stopped after returning from dtrace_proc_create() and calls dtrace_proc_continue().
What I'm missing is how this can happen since dt_proc_control() has a loop calling Psetrun(), which, according to my understanding, would set the child running until it died (and that's what's happening in FreeBSD).
On a related note, I noticed that running 'dtrace -c ls' on Solaris produces 'dtrace: no probes specified' (because dtrace(1) never calls dtrace_proc_continue()), but on Mac OS X, 'dtrace -c ls' effectively runs ls(1) and then prints 'dtrace: no probes specified'.
Any ideas?
Thanks,
--
Rui Paulo
_______________________________________________
dtrace-discuss mailing list
--
Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Rui Paulo
2010-07-07 22:12:55 UTC
Permalink
Hi Adam,
Post by Adam Leventhal
Hey Rui,
From dt_proc_bpmatch() we call the breakpoint handler routines that can invoke dt_proc_stop(). This will wait for main() in dtrace.c to invoke dtrace_proc_continue().
Does that answer your question?
The difference between Mac OS X and Solaris is that I believe we fixed that bug in Solaris. I don't have the ID handy.
Thanks.

Apparently the problem was that our rtld only has POSTINIT and DTrace was expecting PREINIT. Since that never occurred, libdtrace kept calling Psetrun(). After fixing that problem the DTrace process control is now functional.

Regards,
--
Rui Paulo

Loading...