Charles Martin
2007-Apr-17 23:30 UTC
[dtrace-discuss] userfunc.d --- documentation bug or what?
On pg 355 of the dtrace user guide, there''s a short program to trace functino calls in a user program, to whit: pid$1::$2:entry { self->trace = 1; } pid$1::$2:return /self->trace/ { self->trace = 0; } pid$1:::entry, pid$1:::return /self->trace/ { } According to the document on page 356, this should produce nifty output like this: # ./userfunc.d 15032 execute dtrace: script ''./userfunc.d'' matched 11594 probes 0 -> execute 0 -> execute 0 -> Dfix 0 <- Dfix 0 -> s_strsave 0 -> malloc 0 <- malloc 0 <- s_strsave 0 -> set 0 -> malloc 0 <- malloc 0 <- set 0 -> set1 0 -> tglob 0 <- tglob 0 <- set1 0 -> setq 0 -> s_strcmp 0 <- s_strcmp ... but what it produces instead is more like: 0 39640 tsort:entry 0 42589 tsort:return 0 42506 load_completion:return 0 39552 is_dep_ready:entry 0 42501 is_dep_ready:return 0 39551 is_dep_init:entry 0 42500 is_dep_init:return 0 39587 leave:entry 0 39544 rd_event:entry 0 42493 rd_event:return 0 39586 fmap_setup:entry 0 42535 fmap_setup:return 0 39529 rt_bind_clear:entry 0 42071 _ti_bind_clear:entry 0 45012 _ti_bind_clear:return 0 42478 rt_bind_clear:return 0 39527 rt_mutex_unlock:entry 0 39858 _lwp_mutex_unlock:entry 0 42805 _lwp_mutex_unlock:return 0 42476 rt_mutex_unlock:return 0 39529 rt_bind_clear:entry 0 42071 _ti_bind_clear:entry 0 45012 _ti_bind_clear:return 0 42478 rt_bind_clear:return 0 42536 leave:return 0 42622 elf_bndr:return 0 42395 elf_rtbndr:return 0 42196 _close:entry 0 45136 _close:return 0 44389 fclose:return 0 41446 fclose:entry 0 41445 _fflush_u:entry 0 44388 _fflush_u:return 0 42196 _close:entry 0 45136 _close:return 0 44389 fclose:return dtrace: pid 5989 has exited I''m sure I''ve seen the nifty indented output elsewhere, but sadly I can''t find it. Could someone tell me (a) how to get the indented with -> style? and (b) where to send documentation bug reports? Thanks -- Laissez-nous faire, laissez-nous passer. Le monde va de lui-m?me.
Michael Schuster
2007-Apr-17 23:33 UTC
[dtrace-discuss] userfunc.d --- documentation bug or what?
use the ''-F'' option or the flowindent pragma - for details, see ... oh right, you''ve got it already ;-) Michael Charles Martin wrote:> On pg 355 of the dtrace user guide, there''s a short program to trace > functino calls in a user program, to whit: > > pid$1::$2:entry > { > self->trace = 1; > } > > pid$1::$2:return > /self->trace/ > { > self->trace = 0; > } > > pid$1:::entry, > pid$1:::return > /self->trace/ > { > } > > According to the document on page 356, this should produce nifty > output like this: > > # ./userfunc.d 15032 execute > dtrace: script ''./userfunc.d'' matched 11594 probes > 0 -> execute > 0 -> execute > 0 -> Dfix > 0 <- Dfix > 0 -> s_strsave > 0 -> malloc > 0 <- malloc > 0 <- s_strsave > 0 -> set > 0 -> malloc > 0 <- malloc > 0 <- set > 0 -> set1 > 0 -> tglob > 0 <- tglob > 0 <- set1 > 0 -> setq > 0 -> s_strcmp > 0 <- s_strcmp > > ... but what it produces instead is more like: > > 0 39640 tsort:entry > 0 42589 tsort:return > 0 42506 load_completion:return > 0 39552 is_dep_ready:entry > 0 42501 is_dep_ready:return > 0 39551 is_dep_init:entry > 0 42500 is_dep_init:return > 0 39587 leave:entry > 0 39544 rd_event:entry > 0 42493 rd_event:return > 0 39586 fmap_setup:entry > 0 42535 fmap_setup:return > 0 39529 rt_bind_clear:entry > 0 42071 _ti_bind_clear:entry > 0 45012 _ti_bind_clear:return > 0 42478 rt_bind_clear:return > 0 39527 rt_mutex_unlock:entry > 0 39858 _lwp_mutex_unlock:entry > 0 42805 _lwp_mutex_unlock:return > 0 42476 rt_mutex_unlock:return > 0 39529 rt_bind_clear:entry > 0 42071 _ti_bind_clear:entry > 0 45012 _ti_bind_clear:return > 0 42478 rt_bind_clear:return > 0 42536 leave:return > 0 42622 elf_bndr:return > 0 42395 elf_rtbndr:return > 0 42196 _close:entry > 0 45136 _close:return > 0 44389 fclose:return > 0 41446 fclose:entry > 0 41445 _fflush_u:entry > 0 44388 _fflush_u:return > 0 42196 _close:entry > 0 45136 _close:return > 0 44389 fclose:return > dtrace: pid 5989 has exited > > I''m sure I''ve seen the nifty indented output elsewhere, but sadly I > can''t find it. > > Could someone tell me (a) how to get the indented with -> style? and > (b) where to send documentation bug reports? > > Thanks >-- Michael Schuster Recursion, n.: see ''Recursion''