#!/usr/sbin/dtrace -s /* usage is: printarg.d function num -cprogram where num is the position of the argument to be printed (zero-based like in dtrace). For example: printarg.d XLoadFont 1 -c dtterm This prints out the 2nd argument to XLoadFont() which is the fontname. */ # pragma D option quiet pid$target::$1:entry { printf("%s: arg%d=%s\n",probefunc,$2, $2==0 ? copyinstr(arg0) : $2==1 ? copyinstr(arg1) : $2==2 ? copyinstr(arg2) : $2==3 ? copyinstr(arg1) : $2==4 ? copyinstr(arg4) : $2==5 ? copyinstr(arg5) : $2==6 ? copyinstr(arg6) : $2==7 ? copyinstr(arg7) : $2==8 ? copyinstr(arg8) : $2==9 ? copyinstr(arg9) : ""); }