This question is asking the same thing, but when I tried:
typedef long long ptr_t;
objc$target:NSWindow:-setTitle?:entry
{
printf( "%30s %10s %x %x %x\n", probemod, probefunc, arg0, arg1, arg2 );
this->str = *(ptr_t*)copyin(arg2+2*sizeof(ptr_t), sizeof(ptr_t));
printf("string addr = %p\n", this->str);
printf("string val = %s\n", copyinstr(this->str));
}
It didn't work. arg2 should be the address of the NSString. I got:
NSWindow -setTitle: 100685240 7fff92d82f73 7fff78a6eb80 string addr = 7fff8e7e83b9 string val=Window dtrace: error on enabled probe ID 5 (ID 35737: objc9434:NSWindow:-setTitle::entry): invalid address (0x6c007400690074) in action #8 at DIF offset 24
You can assuming a MacRoman or ASCII encoding of the NSString - basically no need to worry about complicated (from the DTrace perspective) encodings.