[dtrace-discuss] Question about 'long long' and USDT probes

Keith McGuigan Keith.McGuigan at Sun.COM
Mon Sep 10 11:31:43 PDT 2007


Hello,

Someone provided me with an example of USDT usage that doesn't appear to work 
right.  Namely, 'long long' arguments get truncated when read into the DTrace 
script.

Here is a quick example and the output:

 > cat probetest.c
#include <stdio.h>
#include <sys/time.h>
#include <sys/sdt.h>

int main() {
   long long v = 0x0FFFFFFF00000001LL;

   printf("In the user process value = %llx\n",v);
   DTRACE_PROBE1(testprov,getvalue,v);
   return 0;
}

 > cc -c probetest.c
 > cat testprov.d
provider testprov {
         probe getvalue(long long);
};

#pragma D attributes Evolving/Evolving/Common provider testprov provider
#pragma D attributes Private/Private/Unknown provider testprov module
#pragma D attributes Private/Private/Unknown provider testprov function
#pragma D attributes Evolving/Evolving/Common provider testprov name
#pragma D attributes Evolving/Evolving/Common provider testprov args
 > dtrace -G -32 -s testprov.d probetest.o
 > cc -o probetest testprov.o probetest.o
 > cat test.d
testprov$target:::getvalue
{
         printf("In the D script value = %llx\n",arg0);
}
 > dtrace -s test.d -c ./probetest
dtrace: script 'test.d' matched 1 probe
In the user process value = fffffff00000001
dtrace: pid 22849 has exited
CPU     ID                    FUNCTION:NAME
  20  46997                    main:getvalue In the D script value = 1


Anyone have any idea what I'm doing wrong here (if anything)?

--
- Keith


More information about the dtrace-discuss mailing list