linux下使用pin的一些问题:一,pin无法将代码插入程序,这可能跟权限有关吧,命令提示:The Operating System configuration prevents Pin from using the default (parent) injection mode.To resolve this,either execute the following (as root):
$ echo 0>/proc/sys/kernel/yama/ptrace_scope
Or use the “-injection child” option
第一个解决方法我没有尝试成功,第二个成功了,即在pin的参数行添加"-injection child",即可通过运行。
PIN能检测的层次:instruction(指令级)、bbl(基本块)、trace、routine(常规)、image(镜像级)
instruction指令级:指的是汇编指令,如mov、loop、etc。
bbl指一个入口和一个出口的语句。
trace是一个入口多个出口的语句,如if
routine相当于一个函数
image是exe,dll之类的映像文件。
下面分别来自inscount0.cpp、inscount1.cpp、proccount.cpp的三个语句
INS_InsertCall(ins,IPOINT_BEFORE, (AFUNPTR)printip, IARG_INST_PTR, IARG_END);
BBL_InsertCall(bbl, IPOINT_BEFORE, (AFUNPTR)docount, IARG_UINT32, BBL_NumIns(bbl);
RTN_InsertCall(rtn,IPOINT_BEFORE, (AFUNPTR)docount,IARG_PTR, &(rc->_rtnCount), IARG_END);
,***_InsertCall()函数,表示在什么情况(针对不同的***由IPOINT_决定在***的前中后还是任意位置)下调用(AFUNPTR)函数进行相应的操作,如输出地址,计数等等。