> To the degree that this parses, I think it's safe to say that finding the
> source is the least of the problems. ;)

> - Bryan

Argh... yes, I realize that the previous sentence was compressed a little too 
much for comfort, but no, it's not line noise..

I'm going off the statement:

"... DTrace requires that each probe clause produce a fixed-length trace
record. This means that the total number of bytes generated by all of
the recording actions (trace, printf, etc.), for one clause, must be
constant. Each clause can generate a different size record, but one
clause must generate the same size record each time it is invoked. If
the designers allowed flow control statements, the size of the trace
record could vary, depending on whether the if condition was true."


The way I parse this is that this limitation makes the following not work

if (cond) { printf("a"); } else { printf("aa"); }

because the first creates a trace 1 byte long, the second 2 bytes.

My suggestion to make this work was to force the trace record to be 2 bytes 
long (null padding or truncating the end as necessary)  no matter what  
condition was reached:

{
    printf.length = 2;
    if (cond) { printf("a"); } else { printf("aa"); }
}

or better yet, have the dtrace interpreter figure this length out if it can, 
and warn if it can't. This would allow for a much more expressive dtrace, and 
would answer everyone's request for conditionals and user functions.

Paul
--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to