如何将指令传递给英特尔 pintool 中的回调

How can i pass instruction to a call back in intel-pintool?

本文关键字:pintool 英特尔 回调 指令      更新时间:2023-10-16

我是pintool的新手,我知道如何传递指令地址回调,方法是使用:
INS_InsertPredicatedCall( ins, IPOINT_BEFORE, (AFUNPTR)MyFunction, IARG_ADDRINT, INS_Address(ins), IARG_END); // My call back function is: MyFunction(UINT64 insAddress) { .... }

有没有办法将指令传递给回调,或者可以从其地址中提取它。
喜欢:

MyFunction( UINT64 insAddress, INS ins ) {.... }
MyFunction(UINT64 insAddress) { INS ins = someFunction(insAddress);// some function that return instruction of a specified address }

我为此使用的解决方案是将 INS 传递到自定义对象中并将这些对象保存到std::map<ADDRINT, Instruction>映射中。然后,当我需要访问说明时,我会按其地址映射它们。似乎工作正常。

我发现有人这么说:
"这是关于分析例程,而不是检测例程。AFAIK,您无法在分析例程中处理 INS、BBL 或 TRACE 类型,并且如您所见,无法将它们传递给分析例程......"