dtrace4linux / linux

dtrace for linux - kernel driver and userland tools
http://crtags.blogspot.com
1.17k stars 226 forks source link

dtrace -s script.d -c binary Not working #115

Open codeorcode opened 9 years ago

codeorcode commented 9 years ago

I am trying to run this script:

!/usr/sbin/dtrace -q

syscall::read:entry, syscall::write:entry /pid == $target/ { printf("execname:%s | %s(%d, 0x%x, %4d)", execname, probefunc, arg0, arg1, arg2); printf("\n\t\t\t\t\ttest: %s", copyinstr(arg1)); }

syscall::read:return, syscall::write:return /pid == $target/ { printf("\t\t = %d\n", arg1); }

The command is: dtrace -s script.d -c "./a.out"

The command should display all reads and writes by my a.out app then exit. But instead it will not exit. I've replaced a.out with a linux command like netstat or ls. Still the script will not exit.

[root@centos6 ~]# dtrace -s b.d -c ./a.out parent: waiting for child parent: after waitpid pid=10187 status=137f child 10187 about to exec ./a.out rd_loadobj_iter rd_loadobj_iter: /lib64/ld-2.12.so 0x7f216aee5000 proc-stub:rd_event_enable proc-stub:rd_event_addr addr=(nil) proc-stub:rd_event_addr addr=(nil) proc-stub:rd_event_addr addr=(nil) dtrace: script 'b.d' matched 8 probes

CentOS is version 6.6, kernel: 2.6.32-504.23.4.el6.x86_64

Any hint what should I do next?