I am trying to change a bit the Memory Reference Trace (Instruction Instrumentation) example from the pin documentation.
My goal is to extract from each instruction that access memory also the size of the size of the memory to read\write in bytes.
I looked in the documentation and found that I need to use
IARG_MEMORYREAD_SIZE
IARG_MEMORYWRITE_SIZE
to hold that size.
I couldn't find though in the documentation how to extract this data from the instruction.
here is my code:
for (UINT32 memOp = 0; memOp < memOperands; memOp++)
{
if (INS_MemoryOperandIsRead(ins, memOp))
{
if(INS_hasKnownMemorySize(ins))
{
//IARG_MEMORYREAD_SIZE memReadSize = what to do here?
INS_InsertPredicatedCall(
ins, IPOINT_BEFORE, (AFUNPTR)MyFuncWhenRead,
IARG_INST_PTR,
IARG_MEMORYOP_EA, memOp,
IARG_END);
}
}
if (INS_MemoryOperandIsWritten(ins, memOp))
{
if(INS_hasKnownMemorySize(ins))
{
//IARG_MEMORYREAD_SIZE memWriteSize = what to do here?
INS_InsertPredicatedCall(
ins, IPOINT_BEFORE, (AFUNPTR)MyFuncWhenWrite,
IARG_INST_PTR,
IARG_MEMORYOP_EA, memOp,
IARG_END);
}
}
}
Would appreciate some help solving this. That is, what to write in the line with the comment
//IARG_MEMORYREAD_SIZE memReadSize = ???
Thanks!