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-Jul-07 20:48 UTC
[dtrace-discuss] Question about DTrace process control
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 On Jul 5, 2010, at 5:51 AM, Rui Paulo wrote:> 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 > > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Hi Adam, On 7 Jul 2010, at 21:48, Adam Leventhal wrote:> 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