> I can fetch the format string easily. (arg0)
> 
> But how can I print out the next argument if I don't know what type its
> going to be? If I try trace() I can get the int's fine, but strings are
> returning as numbers.

This is why I said it would be a pain. You're going to have to do something
like this:

pid123::printf:entry
{
        this->fmt = copyinstr(arg0);
}

/* begin loop */
pid123::printf:entry
/this->fmt/
{
        this->fmt = strchr(this->fmt, '%');
}

pid123::printf:entry
/this->fmt && this->fmt[1] == 'd'/
{
        trace(arg1);
}

pid123::printf:entry
/this->fmt && this->fmt[1] == 's'/
{
        trace(copyinstr(arg1));
}

/* ... and unroll loop to desired length ... */

More or less...

Adam

-- 
Adam Leventhal, Fishworks                     http://blogs.sun.com/ahl
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to