Alexey Vladykin
2009-Oct-26 15:58 UTC
[dtrace-discuss] unexpected stacks with __moddi3 from ustack()
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. -- This message posted from opensolaris.org -------------- next part -------------- A non-text attachment was scrubbed... Name: sampler.d Type: application/octet-stream Size: 156 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20091026/810ca207/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: primes.c Type: application/octet-stream Size: 363 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20091026/810ca207/attachment-0001.obj>
Jonathan Adams
2009-Oct-26 16:13 UTC
[dtrace-discuss] unexpected stacks with __moddi3 from ustack()
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