One Quickie

Fixing DIF offset error (DTrace->General)
Sometimes you might see this error when using copyin or copyinstr:
invalid address (0x10c86e3ce) in action #2 at DIF offset
This happens because the page in question hasn't been faulted in yet, or in general isn't available to the kernel or DTrace at this moment. This can happen if you're accessing the data in an :::entry clause before the data is used.

To work around this, let the function you're tracing do its work, cause the fault of the data into memory, then access the data in the :::return clause. You'll need to hang on the pointer because the function arguments are not passed to :::return:

    self->filename = arg0;

    @files[copyinstr(self->filename)] = count();
    self->filename = 0;

    trunc(@files, 5);

borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book