Skip to content

Instantly share code, notes, and snippets.

@Jinmo
Created May 29, 2015 19:40
Show Gist options
  • Save Jinmo/041d6aec32799557270b to your computer and use it in GitHub Desktop.
Save Jinmo/041d6aec32799557270b to your computer and use it in GitHub Desktop.
PIN Simple "MOV"Tracer
#include "pin.H"
#include <stdio.h>
FILE *out_fp;
VOID TraceMove(VOID *addr) {
fprintf(out_fp, "%p: MOV Here!\n", addr);
}
VOID INSAnalysis(INS ins, VOID *v) {
if (INS_Opcode(ins) == XED_ICLASS_MOV)
INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)TraceMove, IARG_INST_PTR, IARG_END);
}
int main(int argc, char *argv[])
{
out_fp = fopen("log.txt", "w");
if( PIN_Init(argc,argv) )
{
return 0;
}
INS_AddInstrumentFunction(INSAnalysis, 0);
PIN_StartProgram();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment