Christophe Kalt writes:
> No, see http://docs.sun.com/app/docs/doc/817-6223/chp-typeopexpr-10?a=view

The lack of for/while/goto is an intentional omission in the interest
of safety.

If/else, though, is another matter.  You can easily translate any
if/else combination into a series of probes.  For example, the
following is invalid:

        fbt:foo:bar:entry
        /arg0 == 1234/
        {
                trace(arg1);
                if (arg2 == 5678)
                        trace(arg2);
                else
                        trace(arg3);
        }

But you can do something like this, and it's equivalent:

        fbt:foo:bar:entry
        /arg0 == 1234/
        {
                trace(arg1);
                self->test = arg2;
        }

        fbt:foo:bar:entry
        /arg0 == 1234 && self->test == 5678/
        {
                trace(arg2);
        }

        fbt:foo:bar:entry
        /arg0 == 1234 && self->test != 5678/
        {
                trace(arg3);
        }

You can string together sets of probes to get the same effect as any
set of if/else statements.

(It'd sort of be nice to have direct support in the language for
if/else, given the inherent safety and the obvious equivalence ...)

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to