int main(int argc, char *argv[]) { // Initialize pin & symbol manager PIN_InitSymbols(); if( PIN_Init(argc,argv) ) { return Usage(); } thread_init(); PIN_AddFollowChildProcessFunction(FollowChild, 0); // Write to a file since cout and cerr maybe closed by the application TraceFile.open(KnobOutputFile.Value().c_str()); TraceFile << hex; TraceFile.setf(ios::showbase); // Register Image to be called to instrument functions. IMG_AddInstrumentFunction(ImageLoad, 0); IMG_AddUnloadFunction(ImageUnLoad, 0); TRACE_AddInstrumentFunction(trace_instrument, 0); PIN_AddFiniFunction(Fini, 0); // Never returns PIN_StartProgram(); return 0; }
int main(INT32 argc, CHAR **argv) { PIN_Init(argc, argv); PIN_AddFollowChildProcessFunction(FollowChild, 0); PIN_StartProgram(); return 0; }
int main(INT32 argc, CHAR **argv) { PIN_InitSymbols(); PIN_Init(argc, argv); PIN_AddFollowChildProcessFunction(FollowChild, 0); // Never returns if (PIN_IsProbeMode()) { IMG_AddInstrumentFunction(ImageLoad, (VOID *)1); PIN_StartProgramProbed(); } else { IMG_AddInstrumentFunction(ImageLoad, 0); PIN_StartProgram(); } return 0; }
int main(int argc, char * argv[]){ //If we want to debug the program manually setup the proper options in order to attach an external debugger if(Config::ATTACH_DEBUGGER){ initDebug(); } //get the start time of the execution (benchmark) tStart = clock(); // Initialize pin PIN_InitSymbols(); if (PIN_Init(argc, argv)) return Usage(); //Register PIN Callbacks INS_AddInstrumentFunction(Instruction,0); PIN_AddThreadStartFunction(OnThreadStart, 0); IMG_AddInstrumentFunction(imageLoadCallback, 0); PIN_AddFiniFunction(Fini, 0); PIN_AddInternalExceptionHandler(ExceptionHandler,NULL); PIN_AddFollowChildProcessFunction(followChild, NULL); printf("[INFO] Configuring Pintool\n"); //get theknob args ConfigureTool(); if(Config::getInstance()->POLYMORPHIC_CODE_PATCH){ TRACE_AddInstrumentFunction(Trace,0); } proc_info->addProcAddresses(); //init the hooking system HookSyscalls::enumSyscalls(); HookSyscalls::initHooks(); printf("[INFO] Starting instrumented program\n\n"); //MYINFO(" knob inizio %d %d %d",Config::getInstance()->getDumpNumber(), Config::getInstance()->getDumpNumber(),Config::getInstance()->WRITEINTERVAL_MAX_NUMBER_JMP); PIN_StartProgram(); return 0; }
int main(INT32 argc, CHAR **argv) { if (PIN_Init(argc, argv)) return Usage(); // Can't just open for writing because the child process' Pintool may overwrite // the parent process' Pintool file (when the -o parameter doesn't change). // Opening in append mode instead. OutFile.open(KnobOutputFile.Value().c_str(), ofstream::app); PIN_AddFollowChildProcessFunction(FollowChild, 0); // Never returns if (KnobToolProbeMode) { IMG_AddInstrumentFunction(ImageLoad, 0); PIN_StartProgramProbed(); } else { PIN_AddFiniFunction(Fini, 0); PIN_StartProgram(); } return 0; }
int main(int argc, char *argv[]) { // Initialize PIN library. Print help message if -h(elp) is specified // in the command line or the command line is invalid PIN_InitSymbols(); if( PIN_Init(argc,argv) ) { return Usage(); } // Register function to be called to instrument traces // PIN_AddSyscallEntryFunction(SyscallEntryF,0); // PIN_AddSyscallExitFunction(SyscallExitF,0); // TRACE_AddInstrumentFunction(TraceIns, 0); // INS_AddInstrumentFunction(Instruction,0); PIN_AddFollowChildProcessFunction(FollowChild, 0); IMG_AddInstrumentFunction(rtnInst, 0); // INS_AddInstrumentFunction(InstructionProp, 0);//for function summary TRACE_AddInstrumentFunction(Trace, 0); // Register function to be called when the application exits PIN_AddFiniFunction(Fini, 0); cerr << "===============================================" << endl; cerr << "This application is instrumented by MyPinTool" << endl; if (!KnobOutputFile.Value().empty()) { cerr << "See file " << KnobOutputFile.Value() << " for analysis results" << endl; string fileName = KnobOutputFile.Value(); out.open(fileName.c_str()); out << hex; // out.open(fileName.c_str()); // out << hex; } cerr << "===============================================" << endl; // Start the program, never returns PIN_StartProgram(); return 0; }