On Tue, Jul 21, 2009 at 07:25:58AM -0400, Chad Mynhier wrote: > On Tue, Jul 21, 2009 at 2:52 AM, Matt Ingenthron<mingenth...@acm.org> wrote: > > > > I have a USDT provider in memcached which is defined as either a positive > > value returned or -1 if there is no result. ?From my DTrace script, the > > value returned seems to be 4294967295 when I'm expecting a -1 so it seems > > to be treating it as unsigned. ?The value is defined as an int in the USDT > > probe and the program, and isainfo -b returns 64, though I am working with > > a 32-bit binary. > [ ... ] > > > > If I add a cast to the script, I get the expected behavior when the probe > > fires: > > > > memcached*::command-* > > { > > ?printf("key is %s, length is %d\n", copyinstr(arg1), (signed int) arg3); > > } > > > > Why should this be necessary in this case? > > The types for arg0, arg1, etc., are int64_t. In your case, you're > trying to print a negative 32-bit value, which is a positive 64-bit > value, thus the need for the cast.
To be more particular, in order to get the types from the provider, you must use the args[] array, not the arg? variables. Try doing: printf("key is %s, length is %d\n", copyinstr(arg1), args[3]); Cheers, - jonathan
_______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org