[dtrace-discuss] dtracing dtrace
Peter Boros
Peter.Boros at Sun.COM
Tue Dec 5 09:52:23 PST 2006
Hi!
I am trying to dtrace dtrace itself and understand what happens when a D
function call is make. So, here is a simple script I am trying to trace:
#!/usr/sbin/dtrace
dtrace:::BEGIN
{
printf("%d\n",strlen("123456"));
}
I have managed to trace the function calls, but I want to know more
about the arguments. Here is my dtrace dtracing script:
#!/usr/sbin/dtrace -qs
#pragma D option flowindent
pid$1:libdtrace.so.1:dt_idcook_func:entry
{
self->trace = 1;
}
pid$1:libdtrace.so.1::entry,
pid$1:libdtrace.so.1::return
/self->trace/
{
printf("%s\n", curlwpsinfo->pr_syscall ? "K" : "U");
}
pid$1:libdtrace.so.1:dt_idcook_func:entry
/self->trace/
{
printf("%s\n", args[1]->di_name);
}
pid$1:libdtrace.so.1:dt_idcook_func:return
/self->trace/
{
self->trace = 0;
}
dt_idcook_func's second argument is a dt_ident_t struct, which has a
di_name member. When running the "strlen script" above dt_idcook_func is
called 41 times, I want to find out why. When I try to run the dtrace
tracing script:
dtrace: failed to compile script ./tracer.d: line 19: index 1 is out of
range for pid103366:libdtrace.so.1:dt_idcook_func:entry args[ ]
And by the way args[0] is out of range too. What am I doing wrong?
Do I have to include some dtrace source header files?
Peter
More information about the dtrace-discuss
mailing list