带有 PinPlay RTN_InsertCall 回调的 Intel Pin 未在回放时执行

Intel Pin with PinPlay RTN_InsertCall callback not executing on replay

我将英特尔的 Pin API 与 Pinplay 重放框架一起使用,但在执行重放时无法执行以下命令:

VOID Arg1Before(char *name, ADDRINT arg1) {
  tracefile << name << "(" << arg1 << ")" << endl;
}

VOID Routine(RTN rtn, VOID *v) {
  RTN_Open(rtn);
  if (RTN_Name(rtn) == "malloc") {
    RTN_InsertCall(rtn, IPOINT_BEFORE, (AFUNPTR)Arg1Before,
                   IARG_ADDRINT, "malloc",
                   IARG_FUNCARG_ENTRYPOINT_VALUE, 0,
                   IARG_END); 
  }
  RTN_Close(rtn);
}

这在功能上类似于 Pin 的 SimpleExamples/malloctrace.cpp 示例程序。

正在重播的弹珠台创建于:

$PIN_ROOT/pin -t $PIN_ROOT/extras/pinplay/bin/intel64/pinplay-malloctracer.so \
    -log -log:basename pinball/foo -- /usr/bin/ls

并重播使用:

$PIN_ROOT/pin -xyzzy -reserve_memory pinball/foo.address \
    -t $PIN_ROOT/extras/pinplay/bin/intel64/pinplay-malloctracer.so \
    -replay -replay:basename pinball/foo \
    -- ../pin-2.14/extras/pinplay/bin/intel64/nullapp

调试显示 Routine() 被正确调用,但插入的调用从未被执行。

我的操作系统是 RHEL。

我遇到了同样的问题,得到了答案here,如果你使用python脚本来记录程序,你只需要提供-log:image_ops选择它。就像

$pinpoints.py --cfg test.cfg --log_options="-log:image_ops" -l 

另请检查您的常规检测功能。我觉得应该是

RTN_Name(rtn) == "__libc_malloc"