[dtrace-discuss] DTrace erroneously truncates return values to 32 bits on 32-bit kernels

William J. Kucharski William.Kucharski at Sun.COM
Wed Aug 23 03:54:01 PDT 2006


I've just filed CR 6462995 on this but Adam Leventhal suggested I mention it here as a heads up:

There's currently a bug in DTrace where 64-bit return values are truncated to 32 bits in length on 32-bit kernels.

For example, given this script:

#pragma D option quiet

fbt::getpid:return
{
        printf("\n\tpid %d  ppid %d\n", pid, ppid);
        printf("\trval 0x%x pid %d  ppid %d\n", args[1], args[1] & 0xffffffff,
                args[1] >> 32);
} 

When run on a 64-bit kernel, it will produce output as expected, e.g.:

# dtrace -s ./getpid.d

        pid 665021  ppid 133049
        rval 0x207b9000a25bd pid 665021  ppid 133049

But when run on a 32-bit kernel, the top 32 bits of the return value will go missing:

# dtrace -s ./getpid.d

        pid 100246  ppid 1
        rval 0x18796 pid 100246  ppid 0 

Adam already knows what's wrong. :-)
 
 
This message posted from opensolaris.org


More information about the dtrace-discuss mailing list