[Bug 222752] DTrace: probe syscall::write:entry is not fired unless printf in action
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Oct 3 10:51:19 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222752
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 at FreeBSD.org
Reporter: hannes at 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.
(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
==============================
#include <stdio.h>
#include <unistd.h>
int main (int argc, char ** argv) {
printf("START");
printf("BOOOOOOOO\n");
printf("STOP");
printf("done now\n");
}
==============================
t.d
==============================
#!/usr/sbin/dtrace -Cs
#pragma D option quiet
#define prog "t"
#define act execname == prog && self->started == 1
syscall::write:entry
/arg0 == 1 && (string)copyin(arg1, 5) == "START"/
{
self->started = 1;
}
syscall::write:entry
/act && arg0 == 1 && (string)copyin(arg1, 4) == "STOP" && self->started == 1/
{
exit(0);
}
==============================
t2.d
==============================
#!/usr/sbin/dtrace -Cs
#pragma D option quiet
#define prog "t"
#define act execname == prog && self->started == 1
syscall::write:entry
/arg0 == 1 && (string)copyin(arg1, 5) == "START"/
{
printf("starting\n");
self->started = 1;
}
syscall::write:entry
/act && arg0 == 1 && (string)copyin(arg1, 4) == "STOP" && self->started == 1/
{
printf("exiting now\n");
exit(0);
}
==============================
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list