intel-pin - Intel Pin 3.0无法识别MPX指令?

标签 intel-pin

我有最新版本的 Intel Pin 3.0 版本 76887。

我有一个支持 MPX 的玩具示例:

#include <stdio.h>
int g[10];
int main(int argc, char **argv) {
  int x = g[11];
  printf("%d\n", x);
  return 0;
}

当使用 gcc + MPX 编译时,我通过 objdump 在反汇编中看到 MPX 指令,并且该示例正确地向我写入了边界冲突:

Saw a #BR! status 0 at 0x401798

现在我想计算使用 Intel Pin 的特定 MPX 指令的总数,例如 BNDLDXBDMK

我的第一次尝试是使用附带的工具source/tools/SimpleExamples/trace.cpp。这个工具向我展示了 MPX 指令处的 NOP

在第二次尝试中,我使用以下代码片段编写了自己的工具:

xed_iclass_enum_t iclass = (xed_iclass_enum_t)INS_Opcode(ins);
if (iclass == XED_ICLASS_BNDMK)
    INS_InsertPredicatedCall(ins, IPOINT_BEFORE, (AFUNPTR)countBndmk, IARG_END);

这不起作用,countBndmk 永远不会被调用。我用其他指令类仔细检查了我的代码,它们起作用了。很明显存在 Pin(或 XED?)无法识别 MPX 指令的问题。

<小时/>

浏览文档,我注意到一个有趣的旋钮

KNOB<BOOL> knob_mpx_mode(KNOB_MODE_WRITEONCE,"supported:xed","xed_mpx_mode","0","Enable Intel(R) MPX instruction decoding")

这个旋钮似乎启用了 MPX 解码,默认情况下为 0,我不知道如何在每个命令行或我的工具中启用它。我在代码或互联网中没有发现其他关于此问题的引用。

<小时/>

我知道我可以使用 Intel SDE 转储调试跟踪,包括 MPX 指令。我想知道是否有办法在 Intel Pin 中启用 MPX。或者唯一的解决方案是自己解码操作码?

最佳答案

也许回答有点晚了,但看来您只需将选项传递给 PIN 即可。

一点背景知识:

在英特尔手册上有这样一行(与 MPX 无关,但它提供了一个线索):

Add the knob support_jit_api to the Pin command line as Pin tool option:
    <Pin executable> <pin options> -t <Pin tool> -support_jit_api <Other Pin tool options> -- <Test application> <Test application options>

它发生了there's an existing KNOB对于此选项:

KNOB<BOOL> LEVEL_PINCLIENT::KnobJitApi  (   KNOB_MODE_WRITEONCE     ,
"pintool:sym"   ,
"support_jit_api"   ,
"0"     ,
"Enables the Jitted Functions Support"  
)

由于 MPX 旋钮定义为:

KNOB<BOOL> knob_mpx_mode(KNOB_MODE_WRITEONCE,"supported:xed","xed_mpx_mode","0","Enable Intel(R) MPX instruction decoding")

我想您只需将选项传递给 PIN 即可:

<Pin executable> <pin options> -t <Pin tool> -xed_mpx_mode <Other Pin tool options> -- <Test application> <Test application options>

这些旋钮似乎被硬编码到 PIN/PinTools 上。

关于intel-pin - Intel Pin 3.0无法识别MPX指令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40047962/

相关文章:

c++ - 在 Intel Pin 中使用 IARG_MEMORYWRITE_SIZE 和 IARG_MEMORYREAD_SIZE 参数

intel-pin - intel pin工具中图像的含义

c - 强制内存分配始终到相同的虚拟地址

c - 使用Intel的PIN工具来计算程序中缓存命中/未命中的次数

c++ - PIN 工具能否检测包含运行其他命令的代码的 bash 脚本?

c++ - 密码 : identify MOV and indirect memory operand

ubuntu - Ubuntu 17.04 的 Pin 工具段错误

c - 为什么空 C 程序中执行的指令总数会发生变化?

c++ - 将元素添加到结构 vector 的全局 vector

c++ - 英特尔 Pin 主线程