Intel Pin:IARG_REG_VALUE REG无效的REG:xmm0 [英] Intel Pin:Invalid REG for IARG_REG_VALUE reg: xmm0

查看:124
本文介绍了Intel Pin:IARG_REG_VALUE REG无效的REG:xmm0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序来跟踪程序,但遇到标题之类的错误,我遇到了麻烦. 有谁能听得懂什么?

I'm making a program to trace the program, but I am having trouble with the error like the title. Is there anyone who can understand something?

INS_InsertCall(ins, action, AFUNPTR(RegOpnd::at_call),
            IARG_PTR, data,
            IARG_PTR, this,
            IARG_REG_VALUE, reg_,
            IARG_END);

我检查了IARG_REG_VALUE与xmm寄存器不兼容. 如何获取信息?

I checked that IARG_REG_VALUE was not compatible with xmm registers. How can I get the information?

推荐答案

作为

这不能用于检索大小大于ADDRINT的寄存器的值(例如x87 FPU/XMM/YMM/ZMM/opmask)

this cannot be used to retrieve the value of registers whose size is larger than ADDRINT (e.g. x87 FPU/XMM/YMM/ZMM/opmask)

您有两个选择,或者:

  • Test for the type of the register and use IARG_REG_CONST_REFERENCE (or IARG_REG_REFERENCE if you wish to modify the register).
  • Get the CPU context (using IARG_CONST_CONTEXT or IARG_CONTEXT if you wish to modify any register in it) and inspect the registers in the context.

我猜第一个选项是更有意义的一个选项,因此它应该大致类似于以下代码:

I guess that the first option is the more meaningful one, so it should go approximately like the code below:

警告:以下代码尚未经过测试/编译...

Warning: code below has not been tested / compiled...

仪器:

const unsigned int opnd_count =  INS_OperandCount(ins);
for(unsigned int i=0; i < opnd_count;i++)
{
    if (INS_OperandIsReg(ins,i))
    {
        REG r = INS_OperandReg(ins,i);
        if ((r))
        {
            INS_InsertCall(ins, IPOINT_AFTER, (AFUNPTR)xmm_arg, 
                           IARG_REG_CONST_REFERENCE, r,
                           IARG_REG_REFERENCE, r, // you might remove this one if you don't modify the reg.
                           IARG_UINT32, i,
                           IARG_UINT32, (r-REG_XMM_BASE), // note: REG_XMM_BASE = REG_XMM0
                           IARG_END);
        }

    }
}

分析:

// regConstRef: const reference on the register
// regRef: reference on the register
// opnd_indx: operand index (0 for the 1st inst. op.; 1 for the 2nd inst. op.)
// regno: register number: 0 = XMM0; 1 = XMM1, etc.
VOID xmm_arg(PIN_REGISTER* regConstRef, PIN_REGISTER* regRef, UINT32 opnd_indx, UINT32 regno)
{
    // just "dump" the register
    std::cout << "XMM" << regno << " operand_index: " << opnd_indx << " ";
    for(unsigned int i=0;i< MAX_DWORDS_PER_PIN_REG;i++)
    {
        std::cout << std::setw(10) << regConstRef->dword[i] << " ";
    }  
    std::cout << std::endl;
}  

这篇关于Intel Pin:IARG_REG_VALUE REG无效的REG:xmm0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆