Casting it explicitly as "uintptr_t" works for 64 bit program and not for 32 
bit program.

$CC  -xarch=v9 sample.cpp

$dtrace -s sample.d -c ./a.out
dtrace: script 'sample.d' matched 1 probe
CProgram: 20 30 ABCD
dtrace: pid 2974 has exited
CPU     ID                    FUNCTION:NAME
  0  47856      __1cEsub16FpnDxxx__v_:entry DTrace: 20 30
DTrace: name=ABCD


$CC  sample.cpp

$dtrace -s sample.d -c ./a.out
dtrace: script 'sample.d' matched 1 probe
CProgram: 20 30 ABCD
dtrace: error on enabled probe ID 1 (ID 47856: 
pid2979:a.out:__1cEsub16FpnDxxx__v_:entry): invalid address (0x2872800000000) 
in action #4 at DIF offset 28
dtrace: pid 2979 has exited


$cat sample.d
struct xxx
{
   int yyy;
   int zzz;
   const char *name;
};

pid$target:a.out:*sub1*:entry
{
   sp = (struct xxx *) copyin (arg0, sizeof (struct xxx));
   printf ("DTrace: %d %d \n", sp->yyy, sp->zzz);
   printf ("DTrace: name=%s\n", copyinstr((uintptr_t)sp->name));
   exit (0);
}


      
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to