首页 > 解决方案 > 如何使用 RTN_FindByName 查找函数?

问题描述

我正在努力寻找一个mul(float,float)我尝试使用的原型函数,RTN_FindByName但输出仍然是空的。

VOID Arg1Before(CHAR * name, ADDRINT size)
{
    TraceFile << name << "(" << size << ")" << endl;
}
VOID MulAfter(ADDRINT ret)
{
    TraceFile << "  returns " << ret << endl;
}
VOID Image(IMG img, VOID *v)
{
// Instrument the mul() and div() functions.  Print the input argument
// of each mul() or div(), and the return value of mul().
//
//  Find the mul() function.
RTN mulRtn = RTN_FindByName(img, MUL);
if (RTN_Valid(mulRtn))
{
    RTN_Open(mulRtn);
    // Instrument mul() to print the input argument value and the return value.
    RTN_InsertCall(mulRtn, IPOINT_BEFORE, (AFUNPTR)Arg1Before,
                   IARG_ADDRINT, MUL,
                   IARG_FUNCARG_ENTRYPOINT_VALUE, 0,
                   IARG_END);
    RTN_InsertCall(mulRtn, IPOINT_AFTER, (AFUNPTR)MulAfter,
                   IARG_FUNCRET_EXITPOINT_VALUE, IARG_END);
    RTN_Close(mulRtn);
}
}

那里有MUL一个常数,它是"mul"。显然,我已经包含了 pin.H。问题是我的 traceFile 仍然是空的

标签: c++linuxintelintel-pin

解决方案


推荐阅读