On 5/8/16 13:53 , Robert Lindstädt wrote: > Hi, > > as a reference (and nicer rendering), I was asking this question on stack > overflow but got pointed here. I would be very thankful for your help: > http://stackoverflow.com/questions/37033240/dtrace-from-c-does-not-yield-same-profiling-result-compared-to-command-line > > <http://stackoverflow.com/questions/37033240/dtrace-from-c-does-not-yield-same-profiling-result-compared-to-command-line> > > > I want to programmatically trace stacks from C for Node.js (JS addresses > aside). > > The following command gives me stacks with resolved c++ symbols. > > sudo dtrace -C -n 'profile-101 /pid == 13221/ { ustack() }‘ > > The following C code however only returns addresses for Node's C/C++ code. > What would be the equivalent?
So, all the symbol resolution processing is always done in user land. In other words, DTrace in the kernel only ever gathers addresses like you're seeing for the cases where you're using ustack and not a ustack handler via the jstack() action (jstack() also only returns symbols for non-native frames). Note that if you want to see the JavaScript specific symbols in addition to the native ones, you'll want to be using jstack() in your examples and not ustack(). The way that these you can perform these mappings will change depending on what system you're on. If you look at what DTrace does on illumos for printing the results of ustack() (http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libdtrace/common/dt_consume.c#1320), then you'll see that it uses libproc and the Plookup_by_addr() function to perform the translation. Though it's worth pointing out that neither are stable interfaces, though they seldom change. Robert ------------------------------------------- dtrace-discuss Archives: https://www.listbox.com/member/archive/184261/=now RSS Feed: https://www.listbox.com/member/archive/rss/184261/25769126-e243886f Modify Your Subscription: https://www.listbox.com/member/?member_id=25769126&id_secret=25769126-8d47a7b2 Powered by Listbox: http://www.listbox.com