Created
May 29, 2015 19:40
-
-
Save Jinmo/041d6aec32799557270b to your computer and use it in GitHub Desktop.
PIN Simple "MOV"Tracer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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