[dtrace-discuss] dtracing dtrace
Chip Bennett
cbennett at laurustech.com
Tue Dec 5 10:47:48 PST 2006
Peter,
This error message is overloaded. In addition to meaning that you've
strayed outside the bounds of an existing args array, it also means
you've strayed outside the bounds of a non-existent args array. In
other words, in this case, there is no index that is in bounds.
fbt probes, SDT based probes, and USDT based probes all define the args
array upon clause entry, but the pid provider does not. You'll need to
use the arg0, arg1, ... 64-bit integers and cast them.
Chip
Peter Boros wrote:
> 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
>
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
>
More information about the dtrace-discuss
mailing list