Hi,

Hi, I'm typing this without any testing, so I might be slightly wrong
somewhere. You don't need translators.

========================================================================
#!/usr/sbin/dtrace -s

#pragma D option quiet
/* this will stop dtrace to show whatever it shows by default, so that
 * your printf functions output won't get distorted */

typedef struct {
        int age;
        char name[24];
        char class;
} student_t;

pid$target::setdata:entry{
        /* You have to remember the address in entry point */
        self->addr = arg1;
}

pid$target::setdata:return
/ self-> addr /
{
        /* Use this probe only when we got address at entry point first */
        /* return probe uses only arg0 - address of the returning instruction 
in fuction */
        /*                    and arg1 - return value */
        student = (student_t*)copyin(self->addr, sizeof(student_t));
        printf("it is %i\n", student->age); 
        self->addr = 0; /* this will release self->addr variable, otherwise it 
will occupy dtrace's memory */
} 
========================================================================

Oh, and for 32bit binaries you should to run it using 'dtrace -32 -s .....' 

Hope this helps

-- 
        Vlad

Attachment: pgpPc5yfJwQbf.pgp
Description: PGP signature

_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to