Hi Robert, Thanks for suggesting the one-liner. Also ofcourse the a.out should not have stripped symbols.
Thanks On 24/07/19, 9:36 PM, "Robert Mustacchi" <[email protected]> wrote: On 7/24/19 5:16 , ngadre via dtrace-discuss wrote: > Hi, > > I come from Linux background, and currently working on Dtrace on FreeBSD. > Having worked on SystemTap on Linux, I worked with para-callgraph.stp a lot to trace user-space function calls, of user defined functions to understand new utilities. > > Is there a utility like para-callgraph.stp available in dtrace. If not, is it feasible to create one (provided there are constructs available). > > #!/usr/bin/stap > > function trace(entry_p, extra) { > %( $# > 1 %? if (tid() in trace) %) > printf("%s%s%s %s\n", > thread_indent (entry_p), > (entry_p>0?"->":"<-"), > ppfunc (), > extra) > } > > > %( $# > 1 %? > global trace > probe $2.call { > trace[tid()] = 1 > } > probe $2.return { > delete trace[tid()] > } > %) > > probe $1.call { trace(1, $$parms) } > probe $1.return { trace(-1, $$return) } > > I was trying to rewrite this for dtrace, dtrace understands conditional compilation as well. So will this work for tracing call-graphs of user space programs if written as a dtrace script. The dtrace -F option (flowindent) I believe does the indenting that you want. And the pid provider allows you to specify aribtrary parts of userland. So, I believe that something like is a pretty close approximation: dtrace -F -n 'pid$target:a.out::entry,pid$target:a.out::return' -c /bin/ls You'll have to modify it for various parts of functions and libraries you want and pick a number of explicit parameters. Robert ------------------------------------------ DTrace: dtrace-discuss Permalink: https://urldefense.proofpoint.com/v2/url?u=https-3A__dtrace.topicbox.com_groups_dtrace-2Ddiscuss_T97a77925c6df6847-2DM2018b5baa1de95f16403762a&d=DwIFaQ&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=uvshuzPP7EZ2bXpQoH_kGdyPcKb9ytkTNpbhu9vAyJY&m=UjoWdQjzk5zNtsG8TPZzkq3NotVgg-jbtc5bxvTX68c&s=5K_LRq21bLiP-cSSExkhJerzzjKv0E0LrYqn4g6C9IM&e= Delivery options: https://urldefense.proofpoint.com/v2/url?u=https-3A__dtrace.topicbox.com_groups_dtrace-2Ddiscuss_subscription&d=DwIFaQ&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=uvshuzPP7EZ2bXpQoH_kGdyPcKb9ytkTNpbhu9vAyJY&m=UjoWdQjzk5zNtsG8TPZzkq3NotVgg-jbtc5bxvTX68c&s=IdFtsO0-yMtgslszwGX3dqsVxr80SZNnQI8NqkcR_Pk&e= ------------------------------------------ DTrace: dtrace-discuss Permalink: https://dtrace.topicbox.com/groups/dtrace-discuss/T97a77925c6df6847-M865dbb36115384fbf8c35e55 Delivery options: https://dtrace.topicbox.com/groups/dtrace-discuss/subscription
