If the kernel is 64-bit and the traced program is 32-bit, you'll want  
to change your structure definition so that it reflects the bitness of  
the traced program. This means that for pointers you should use a  
uint32_t rather than a char * for example.

Adam

On Nov 3, 2008, at 4:44 AM, [EMAIL PROTECTED] wrote:

> 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);
> }
>
>
>


--
Adam Leventhal, Fishworks                        http://blogs.sun.com/ahl

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

Reply via email to