I am using Intel PIN to modify memory allocation in the system.
I cannot find a way to get the actual values under memory instructions.
VOID Instruction(INS ins, VOID *v) {
UINT32 memOperands = INS_MemoryOperandCount(ins)
for (UINT32 memOp = 0; memOp < memOperands; memOp++) {
if (INS_MemoryOperandIsRead(ins, memOp)) {
INS_InsertPredicatedCall(
ins, IPOINT_BEFORE, (AFUNPTR)RecordMemRead,
IARG_INST_PTR,
IARG_MEMORYOP_EA, memOp,
IARG_END);
}
if (INS_MemoryOperandIsWritten(ins, memOp)) {
INS_InsertPredicatedCall(
ins, IPOINT_BEFORE, (AFUNPTR)RecordMemWrite,
IARG_INST_PTR,
IARG_MEMORYOP_EA, memOp,
IARG_END);
}
}
}
VOID RecordMemRead(VOID * ip, VOID * addr) {
if (!Record) return;
printf("%p: R %p\n", ip, addr);
}
VOID RecordMemWrite(VOID * ip, VOID * addr) {
if (!Record) return;
printf("%p: R %p\n", ip, addr);
}
As I understand this only prints the instruction pointer and the register address of the operand. Is that correct? If so, how can I get the value of this register?
Ultimately, what I am trying to do is intercept all assignments to static and heap variables and translate them to some procedure calls to save the values on Google Bigtable.