/* * NullPin * * used for estimating the overhead of Pin */ int main(int argc, char **argv) { /* initialize symbol processing */ PIN_InitSymbols(); /* initialize PIN; optimized branch */ if (unlikely(PIN_Init(argc, argv))) /* PIN initialization failed */ goto err; /* register trace_ins() to be called for every trace */ TRACE_AddInstrumentFunction(trace_inspect, NULL); /* start PIN */ PIN_StartProgram(); /* typically not reached; make the compiler happy */ return EXIT_SUCCESS; err: /* error handling */ /* return */ return EXIT_FAILURE; }
int main(int argc, char *argv[]) { string trace_header = string("#\n" "# Compressed Instruction Trace Generated By Pin\n" "#\n"); if( PIN_Init(argc,argv) ) { return Usage(); } TraceFile.open(KnobOutputFile.Value().c_str()); TraceFile.write(trace_header.c_str(),trace_header.size()); TRACE_AddInstrumentFunction(Trace, 0); PIN_AddFiniFunction(Fini, 0); // Never returns PIN_StartProgram(); return 0; }
// argc, argv are the entire command line, including pin -t <toolname> -- ... int main(int argc, char * argv[]) { // Enable symbol and line info support PIN_InitSymbols(); // Initialize pin PIN_Init(argc, argv); PIN_InitLock(&lock); // Initialize icount[] for (INT32 t = 0; t < MaxNumThreads; t++) { icount[t]._count = 0; icount[t]._prev_count = 0; icount[t]._line_number = 0; icount[t]._file_name = ""; icount[t]._rtn_name = ""; } sampleRate = KnobSampleRate.Value(); PIN_AddThreadStartFunction(ThreadStart, 0); // Register Instruction to be called to instrument instructions TRACE_AddInstrumentFunction(Trace, 0); // Register Fini to be called when the application exits PIN_AddFiniFunction(Fini, 0); // Start the program, never returns PIN_StartProgram(); return 0; }
int main(int argc, char * argv[]) { PIN_InitSymbols(); if (PIN_Init(argc, argv)) return 1; Stat.open(STAT_FILE); TraceFile.open(TRACE_FILE); RetFile.open(RET_FILE); PIN_InitLock(&lock); tls_key = PIN_CreateThreadDataKey(0); // Register ThreadStart to be called when a thread starts. PIN_AddThreadStartFunction(ThreadStart, 0); TRACE_AddInstrumentFunction(Trace, 0); IMG_AddInstrumentFunction(ImageLoad, 0); INS_AddInstrumentFunction(Instruction, 0); PIN_AddFiniFunction(Fini, 0); PIN_StartProgram(); return 0; }
int main(int argc, char **argv) { PIN_InitSymbols(); if (PIN_Init(argc, argv)) { return Usage(); } OutFile = fopen(KnobOutputFile.Value().c_str(), "wb+"); FileHeader.addrsize = sizeof(ADDRINT); FileHeader.magic = TRACE_RECORD_MAGIC; FileHeader.filesize = sizeof(FileHeader); fwrite(&FileHeader, sizeof(FileHeader), 1, OutFile); TRACE_AddInstrumentFunction(Trace, 0); IMG_AddInstrumentFunction(ImageLoad, 0); PIN_AddFiniFunction(Fini, 0); PIN_StartProgram(); return 0; }
int main(int argc, char *argv[]) { if (PIN_Init(argc, argv)) return Usage(); // Initialize the memory reference buffer bufId = PIN_DefineTraceBuffer(sizeof(struct MEMREF), NUM_BUF_PAGES, BufferFull, 0); if(bufId == BUFFER_ID_INVALID){ cerr << "Error allocating initial buffer" << endl; return 1; } //int len=sizeof(struct MEMREF); //buf_ref=(struct MEMREF*)malloc(MAX_SIZE*len); trace = fopen("pinatrace.out", "w"); outfile = fopen("buffer.out", "w"); // add an instrumentation function TRACE_AddInstrumentFunction(Instruction, 0); PIN_AddFiniFunction(Fini, 0); // Never returns PIN_StartProgram(); return 0; }
void activate() { //FIXME: only one aligner at a time -- not changing output file //name based on a static count of the number of sse_aligner_t //objects. if (knob_verbose) { string filename = knob_output_file.Value(); if( knob_pid ) filename += "." + decstr( getpid_portable() ); out = new std::ofstream(filename.c_str()); } realign_stores = (knob_stores==1); realign_loads = (knob_loads==1); verbose = (knob_verbose==1); // obtain a key for TLS storage tls_key = PIN_CreateThreadDataKey(0); PIN_AddThreadStartFunction(thread_start, this); PIN_AddThreadFiniFunction(thread_fini, this); TRACE_AddInstrumentFunction(instrument_trace, this); if (verbose) *out << "sse aligner activated" << endl; }
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(int argc, char * argv[]) { // Initialize pin PIN_InitSymbols(); if (PIN_Init(argc, argv)) return Usage(); // Initialize the lock InitLock(&lock); // Obtain a key for TLS storage. tls_key = PIN_CreateThreadDataKey(0); // Register ThreadStart to be called when a thread starts. PIN_AddThreadStartFunction(ThreadStart, 0); // Register Instruction to be called to instrument instructions. TRACE_AddInstrumentFunction(Trace, 0); // Register Fini to be called when the application exits. PIN_AddFiniFunction(Fini, 0); // Start the program, never returns PIN_StartProgram(); return 0; }
int main(int argc, char *argv[]) { PIN_InitSymbols(); if( PIN_Init(argc,argv) ) { return Usage(); } TraceFile.open(KnobOutputFile.Value().c_str()); TraceFile << hex; TraceFile.setf(ios::showbase); string trace_header = string("#\n" "# Call Trace Generated By Pin\n" "#\n"); TraceFile.write(trace_header.c_str(),trace_header.size()); TRACE_AddInstrumentFunction(Trace, 0); PIN_AddFiniFunction(Fini, 0); // Never returns PIN_StartProgram(); return 0; }
/* * initialization of the core tagging engine; * it must be called before using everything else * * returns: 0 on success, 1 on error */ int libdft_part_init() { /* initialize thread contexts; optimized branch */ if (unlikely(thread_ctx_init())) /* thread contexts failed */ return 1; /* initialize the tagmap; optimized branch */ if (unlikely(tagmap_alloc())) // /* tagmap initialization failed */ return 2; /* initialize the ins descriptors */ (void)memset(ins_desc, 0, sizeof(ins_desc)); /* register trace_ins() to be called for every trace */ TRACE_AddInstrumentFunction(trace_inspect, NULL); /* FIXME: ugly hack for bypassing unaligned address checks */ PIN_AddInternalExceptionHandler(fix_eflags, NULL); /* success */ return 0; }
int main(int argc, char * argv[]) { // We accumlate counts into a register, make sure it is 64 bits to // avoid overflow ASSERTX(sizeof(ADDRINT) == sizeof(UINT64)); if (PIN_Init(argc, argv)) return Usage(); OutFile.open(KnobOutputFile.Value().c_str()); ScratchReg = PIN_ClaimToolRegister(); if (!REG_valid(ScratchReg)) { std::cerr << "Cannot allocate a scratch register.\n"; std::cerr << std::flush; return 1; } PIN_AddThreadStartFunction(ThreadStart, 0); PIN_AddThreadFiniFunction(ThreadFini, 0); PIN_AddFiniFunction(Fini, 0); TRACE_AddInstrumentFunction(Trace, 0); PIN_StartProgram(); return 0; }
int main( int argc, char *argv[] ) { if ( PIN_Init( argc, argv ) ) { return Usage(); } PIN_InitSymbols(); initRcdcSim(); IMG_AddInstrumentFunction( instrumentImage, NULL ); TRACE_AddInstrumentFunction( instrumentTrace, NULL ); cerr << " Before this function\n"; //INS_AddInstrumentFunction(Instruction, 0); cerr << " After this function\n"; PIN_AddThreadStartFunction( threadBegin, NULL ); PIN_AddThreadFiniFunction( threadEnd, NULL ); PIN_AddContextChangeFunction( beforeSignal, NULL ); PIN_AddSyscallEntryFunction( beforeSyscall, NULL ); PIN_AddSyscallExitFunction( afterSyscall, NULL ); PIN_AddFiniUnlockedFunction( pinFini, NULL ); if ( !CODECACHE_ChangeMaxInsPerTrace( 4096 * 1024 ) ) { fprintf( stderr, "TLSProf::CODECACHE_ChangeMaxInsPerTrace failed.\n" ); } THREADID tid = PIN_SpawnInternalThread( ioThread, NULL, 0, &s_IOThreadId ); assert( tid != INVALID_THREADID ); PIN_StartProgram(); return 0; }
int main(int argc, CHAR *argv[]) { PIN_InitSymbols(); if( PIN_Init(argc,argv) ) { return Usage(); } TRACE_AddInstrumentFunction(Trace, 0); PIN_AddFiniFunction(Fini, 0); IMG_AddUnloadFunction(ImageUnload, 0); out.open(KnobOutputFile.Value().c_str()); out.setf(ios::showbase); out << hex; // Never returns PIN_StartProgram(); return 0; }
//! The pintool's entry point int main(int argc, char *argv[]) { PIN_InitSymbols(); PIN_SetSyntaxIntel(); if(PIN_Init(argc, argv)) return Usage(); /* Init the Triton module */ triton::bindings::python::inittriton(); /* Define Triton architecure */ if (sizeof(void*) == QWORD_SIZE) tracer::pintool::api.setArchitecture(triton::arch::ARCH_X86_64); else tracer::pintool::api.setArchitecture(triton::arch::ARCH_X86); /* During the execution provide concrete values only if Triton needs them - cf #376, #632 and #645 */ tracer::pintool::api.addCallback(tracer::pintool::context::needConcreteRegisterValue); tracer::pintool::api.addCallback(tracer::pintool::context::needConcreteMemoryValue); /* Image callback */ IMG_AddInstrumentFunction(IMG_Instrumentation, nullptr); /* Instruction callback */ TRACE_AddInstrumentFunction(TRACE_Instrumentation, nullptr); /* End instrumentation callback */ PIN_AddFiniFunction(callbackFini, nullptr); /* Syscall entry callback */ PIN_AddSyscallEntryFunction(callbackSyscallEntry, nullptr); /* Syscall exit callback */ PIN_AddSyscallExitFunction(callbackSyscallExit, nullptr); /* Signals callback */ PIN_InterceptSignal(SIGHUP, callbackSignals, nullptr); PIN_InterceptSignal(SIGINT, callbackSignals, nullptr); PIN_InterceptSignal(SIGQUIT, callbackSignals, nullptr); PIN_InterceptSignal(SIGILL, callbackSignals, nullptr); PIN_InterceptSignal(SIGABRT, callbackSignals, nullptr); PIN_InterceptSignal(SIGFPE, callbackSignals, nullptr); PIN_InterceptSignal(SIGKILL, callbackSignals, nullptr); PIN_InterceptSignal(SIGSEGV, callbackSignals, nullptr); PIN_InterceptSignal(SIGPIPE, callbackSignals, nullptr); PIN_InterceptSignal(SIGALRM, callbackSignals, nullptr); PIN_InterceptSignal(SIGTERM, callbackSignals, nullptr); PIN_InterceptSignal(SIGBUS, callbackSignals, nullptr); /* Exec the Pin's python bindings */ tracer::pintool::initBindings(argc, argv); tracer::pintool::execScript(KnobPythonModule.Value().c_str()); return 0; }
int main(INT32 argc, CHAR **argv) { CheckSPAlign(); PIN_Init(argc, argv); TRACE_AddInstrumentFunction(InstrumentTrace, 0); PIN_AddFiniFunction(AtEnd, 0); PIN_StartProgram(); return 0; }
int main(INT32 argc, CHAR **argv) { PIN_Init(argc, argv); TRACE_AddInstrumentFunction(Trace, 0); PIN_AddFiniFunction(Fini, 0); // Never returns PIN_StartProgram(); return 0; }
int main(int argc, char * argv[]) { PIN_Init(argc, argv); PIN_InitSymbols(); PIN_AddSignalInterceptFunction(SIGUSR2, SignalHandler, 0); IMG_AddInstrumentFunction(Image, 0); TRACE_AddInstrumentFunction(Trace, 0); PIN_StartProgram(); return 0; }
int main(int argc, char **argv) { PIN_Init(argc, argv); PIN_InitSymbols(); IMG_AddInstrumentFunction(Image, 0); PIN_AddContextChangeFunction(OnException, 0); TRACE_AddInstrumentFunction(Trace, 0); PIN_StartProgram(); return 0; }
int main(int argc, char * argv[]) { PIN_InitSymbols(); PIN_Init(argc, argv); TRACE_AddInstrumentFunction(Trace, 0); IMG_AddInstrumentFunction(Image, 0); // Never returns PIN_StartProgram(); return 0; }
int main(INT32 argc, CHAR **argv) { PIN_Init(argc, argv); srand(time(0)); CODECACHE_AddCacheInitFunction(LimitTraces, 0); TRACE_AddInstrumentFunction(Trace, 0); // Never returns PIN_StartProgram(); return 0; }
int main(INT32 argc, CHAR **argv) { out = fopen("sequence.out", "w"); PIN_Init(argc, argv); TRACE_AddInstrumentFunction(Trace, 0); // Never returns PIN_StartProgram(); return 0; }
// ------------------------------------------------------------- // Tool startup function // ------------------------------------------------------------- void STool_Run(STool_TSetup* s) { // make setup configuration globally available gSetup = *s; // extract application (path)name and full application command line for (int i=0; i<gSetup.argc-1;) if (!strcmp("--", gSetup.argv[i++])) { int len = 0, j; for (j=i; j<gSetup.argc; ++j) len += strlen(gSetup.argv[j])+1; gAppName = gSetup.argv[i]; gCommandLine = (char*)calloc(len, 1); if (gCommandLine == NULL) exit((printf("Can't allocate command line string\n"),1)); strcat(gCommandLine, gSetup.argv[i]); for (j=i+1; j<gSetup.argc; ++j) { strcat(gCommandLine, " "); strcat(gCommandLine, gSetup.argv[j]); } } // initialize symbol table code, needed for rtn instrumentation PIN_InitSymbols(); // initialize pin if (PIN_Init(gSetup.argc, gSetup.argv)) { Usage(); return; } // obtain a key for TLS storage. gTlsKey = PIN_CreateThreadDataKey(0); // if using memory operations buffering, define a BUF_SIZE-pages trace buffer // and register BufferOverflow to be called when the buffer fills up if (gSetup.memBuf) buf_id = PIN_DefineTraceBuffer(sizeof(STool_TMemRec), BUF_SIZE, BufferOverflow, 0); // register ThreadStart to be called when a thread starts PIN_AddThreadStartFunction(ThreadStart, 0); // register ThreadEnd to be called when a thread ends PIN_AddThreadFiniFunction(ThreadEnd, 0); // register I_Trace to be called to instrument traces TRACE_AddInstrumentFunction(I_Trace, 0); // register Fini to be called when application exits if (gSetup.appEnd) PIN_AddFiniFunction(Fini, 0); // start the program, never returns PIN_StartProgram(); }
int main(int argc, char * argv[]) { cout << hex; cout.setf(ios::showbase); PIN_Init(argc, argv); TRACE_AddInstrumentFunction(Trace, 0); // Never returns PIN_StartProgram(); return 0; }
int main(int argc, char * argv[]) { PIN_InitSymbols(); PIN_Init(argc, argv); TRACE_AddInstrumentFunction(Trace, 0); PIN_AddFiniFunction(Fini, 0); // Start the program, never returns 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(); } MYINFO("->Configuring Pintool<-\n"); //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); //TRACE_AddInstrumentFunction(Trace,0); PIN_AddThreadStartFunction(OnThreadStart, 0); IMG_AddInstrumentFunction(imageLoadCallback, 0); PIN_AddFiniFunction(Fini, 0); PIN_AddInternalExceptionHandler(ExceptionHandler,NULL); //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(); // Start the program, never returns MYINFO("->Starting instrumented program<-\n"); 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 if(PIN_Init(argc,argv)) return Usage(); /// Instrumentations // Register function to be called to instrument traces TRACE_AddInstrumentFunction(trace_instrumentation, 0); // Register function to be called when the application exits PIN_AddFiniFunction(this_is_the_end, 0); // Register function to be called when a module is loaded IMG_AddInstrumentFunction(image_instrumentation, 0); /// Other stuffs // This routine will be called if the sleeping_thread calls PIN_Detach() (when the time is out) PIN_AddDetachFunction(pin_is_detached, 0); // Run a thread that will wait for the time out PIN_SpawnInternalThread( sleeping_thread, 0, 0, NULL ); // If we are in a wow64 process we must blacklist manually the JMP FAR: stub // from being instrumented (each time a syscall is called, it will be instrumented for *nothing*) // Its address is in FS:[0xC0] on Windows 7 ADDRINT wow64stub = __readfsdword(0xC0); modules_blacklisted.insert( std::make_pair( std::string("wow64stub"), std::make_pair( wow64stub, wow64stub ) ) ); /// FIRE IN THE HOLE // Start the program, never returns PIN_StartProgram(); return 0; }
int main(int argc, char * argv[]) { PIN_InitSymbols(); PIN_Init(argc, argv); out.open(KnobOutput.Value().c_str()); TRACE_AddInstrumentFunction(Trace, 0); PIN_AddFiniFunction(AtEnd, 0); // Never returns PIN_StartProgram(); return 0; }
int main(int argc, char * argv[]) { PIN_InitSymbols(); PIN_Init(argc, argv); // Scratch register used to select // instrumentation version. version_reg = PIN_ClaimToolRegister(); TRACE_AddInstrumentFunction(Trace, 0); // Start the program, never returns PIN_StartProgram(); return 0; }
// argc, argv are the entire command line, including pin -t <toolname> -- ... int main(int argc, char * argv[]) { // Initialize pin PIN_Init(argc, argv); // Register Instruction to be called to instrument instructions TRACE_AddInstrumentFunction(Trace, 0); // Register Fini to be called when the application exits PIN_AddFiniFunction(Fini, 0); // Start the program, never returns PIN_StartProgram(); return 0; }