On Mon, Oct 26, 2009 at 08:58:27AM -0700, Alexey Vladykin wrote: > I'm getting quite strange stacks from DTrace's ustack(). Could please anybody > explain what happens and suggest a fix/workaround? > > My D-script is a trivial sampling profiler, see attached sampler.d > Program being profiled is attached as primes.c > > This is a piece of DTrace script output (on OpenSolaris x86): > 1 62906 :profile-100hz 7563566252 1 1 4 0 > primes`__moddi3+0xc4 > > 1 62906 :profile-100hz 7573563203 1 1 4 0 > primes`__moddi3+0x97 > > 1 62906 :profile-100hz 7592475248 1 1 4 0 > primes`__moddi3+0x66 > > 1 62906 :profile-100hz 7602469821 1 1 4 0 > primes`is_prime+0x33 > primes`main+0x5b > primes`_start+0x80 > > Note those "primes`__moddi3" stacks, which consist of only one stack > frame. Where are "primes`is_prime" and "primes`main"? > > BTW, changing "long long" to "long" fixes the problem. But still it's > not clear why ustack() reports __moddi3 alone.
__moddi3 is a runtime support function to allow division of 64-bit integers. It's a leaf function (meaning it doesn't establish its own stack frame), which makes it very difficult to get a stack trace from. 32-bit division doesn't require such a function. If you're on a 64-bit system, compiling with -m64 will also make things better. Cheers, - jonathan _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org