Date: Tue, 03 Oct 2017 10:51:19 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 222752] DTrace: probe syscall::write:entry is not fired unless printf in action Message-ID: <bug-222752-8@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D222752 Bug ID: 222752 Summary: DTrace: probe syscall::write:entry is not fired unless printf in action Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: hannes@mehnert.org I'm using rev322062, compiled (cc -o t t.c) the t.c below, which is a quite small test case just for this bug. The lifecycle of t and DTrace are not equal - thus I try to communicate from the user application (t) to DTrace when to start instrumenting and when to stop. I do this by t writing START and STOP onto stdout, and the D script = to set a thread-local variable. The probe sysctl::write:entry in t.d is not executed - the same one in t2.d, where a printf is added - is executed. My expectation from DTace is that t= .d's sysctl::write:entry would also be executed. I execute "doas ./d.t" in one shell, then execute ./t in another shell.=20 (Running dtrace -c obviously works because DTrace then exits once t exits, = but this is not a solution for my use case (a much bigger instrumentation where= I only want to trace after some initialisation). t.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D #include <stdio.h> #include <unistd.h> int main (int argc, char ** argv) { printf("START"); printf("BOOOOOOOO\n"); printf("STOP"); printf("done now\n"); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D t.d =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D #!/usr/sbin/dtrace -Cs #pragma D option quiet #define prog "t" #define act execname =3D=3D prog && self->started =3D=3D 1 syscall::write:entry /arg0 =3D=3D 1 && (string)copyin(arg1, 5) =3D=3D "START"/ { self->started =3D 1; } syscall::write:entry /act && arg0 =3D=3D 1 && (string)copyin(arg1, 4) =3D=3D "STOP" && self->sta= rted =3D=3D 1/ { exit(0); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D t2.d =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D #!/usr/sbin/dtrace -Cs #pragma D option quiet #define prog "t" #define act execname =3D=3D prog && self->started =3D=3D 1 syscall::write:entry /arg0 =3D=3D 1 && (string)copyin(arg1, 5) =3D=3D "START"/ { printf("starting\n"); self->started =3D 1; } syscall::write:entry /act && arg0 =3D=3D 1 && (string)copyin(arg1, 4) =3D=3D "STOP" && self->sta= rted =3D=3D 1/ { printf("exiting now\n"); exit(0); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-222752-8>