dtrace

DTrace: how to print out memory buffers


I need to trace all pwrite(2) calls done to some specific file and print all buffers that are to be written byte by byte. The data expected is not in ASCII string format so i can't use:

printf("%s\n", copyinstr(arg1))

I learned about copyin(arg1, arg2), but that gives me a void* and all examples i've found covert it to string again by calling stringof, e.g.:

printf("%s\n", stringof(copyin(arg1, arg2)))

What i need is to somehow display all bytes in copyin'ed buffer. Any suggestions?

Thank you, Inso.


Solution

  • Ok, it's done with tracemem(buffer, size) call.