Afshin Salek wrote:
> DTrace experts :),
> 
> How do you go about printing out a complex data structure
> (let's say in kernel for now) using DTrace? I have a structure
> which has fields that are dynamic arrays of other data structures
> that are quite complex themselves. I guess what I'm looking for
> is some kind of function/macro and loop infrastructure.

loops don't exist in DTrace for safety reasons - you cannot tell at 
compile time how often a loop will be executed, therefore the impact on 
the running system cannot be known.

you can "hand graft" several interations of a "loop" with something like 
this (this is an example for a linked list, I guess a dyn. array won't 
be that much harder to do)

myfunc:entry
/arg0 != NULL/
{
        self->d = (cast) arg0;
        /* print data struct once */
        
        self->d = self->d->next;
}

myfunc:entry
/self->d != NULL/
{
        /* print data struct once */
        self->d = self->d->next;
}

and repeat the last clause several as many times as you anticipate it 
may be necessary.

HTH
Michael
-- 
Michael Schuster        http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to