> I just tried stop() as you suggested and I thing something bad is happening
> when you are using this action. Please see following. Having this two very 
> simple dtrace scripts:
> 
> #!/usr/sbin/dtrace -wqs
> /*this is master.d dscript file*/
> 
> proc:::exec-success

My unqualified guess is that exec-success probe is executed right after
the process image is replaced by new one, which is way before any
symbols are loaded from any libraries. So setting in the second script
pid$1:::entry sets probes only in symbols defined in the binary itself.

I tried to create another scenario with third dtrace script in the
middle between master and helper and it seems to work as requested.

I'm attaching the scripts.

On the side note, if you don't want to see realtime linker in the
output, you can try to run the binary with LD_BIND_NOW environment set
(see man ld.so.1)

Hope this helps

-- 
        Vlad
#!/usr/sbin/dtrace -wqs
/*this is master.d dscript file*/

proc:::exec-success
/(execname == "myprog") || its_ours[ppid]/
{
    stop(); /*try to comment this line*/
    its_ours[pid] = 1;
    printf("proccess is %s, %d, %d\n",execname,pid,ppid);
    system("./middle.d %d &",pid);
}
#pragma D option destructive
#pragma D option quiet

dtrace:::BEGIN
{
    system("prun %d", $1); /*try to comment this line*/
}

pid$1:::entry
{
  self->indent++;
  printf("%*s--> %s(%d)\n",2*self->indent," ",probefunc,tid);
}

pid$1:::return
{
  printf("%*s<-- %s(%d)\n",2*self->indent," ",probefunc,tid);
  self->indent = (self->indent-1 < 0 ? 0 : self->indent-1);
}
#!/usr/sbin/dtrace -s
#pragma D option destructive
#pragma D option quiet

dtrace:::BEGIN
{
        system("prun %d", $1); /*try to comment this line*/
        printf ("pid %d armed\n", pid);
}

pid$1::main:entry
{
        stop();
        system("dtrace -s helper.d %d > _%s_%d &",pid,execname,pid);
        exit(0);
}

Attachment: pgpGfhPeNBCnC.pgp
Description: PGP signature

_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to