当前位置: 首页>>代码示例>>C++>>正文


C++ TRACE_AddInstrumentFunction函数代码示例

本文整理汇总了C++中TRACE_AddInstrumentFunction函数的典型用法代码示例。如果您正苦于以下问题:C++ TRACE_AddInstrumentFunction函数的具体用法?C++ TRACE_AddInstrumentFunction怎么用?C++ TRACE_AddInstrumentFunction使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TRACE_AddInstrumentFunction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

/*
 * 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;
}
开发者ID:chubbymaggie,项目名称:bincfp,代码行数:31,代码来源:nullpin.cpp

示例2: main

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;
}
开发者ID:alagenchev,项目名称:school_code,代码行数:26,代码来源:trace.cpp

示例3: main

// 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;
}
开发者ID:alugupta,项目名称:resilient-systems,代码行数:35,代码来源:inscount2_mt_debuginfo.cpp

示例4: main

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;
}
开发者ID:llubu,项目名称:ROP,代码行数:30,代码来源:finalTool.cpp

示例5: main

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;
}
开发者ID:CYBoys,项目名称:RunTracer,代码行数:26,代码来源:runtrace.cpp

示例6: main

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;
}
开发者ID:PineWu,项目名称:MyPinTool,代码行数:29,代码来源:pinatrace.cpp

示例7: activate

    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;
    }
开发者ID:alugupta,项目名称:resilient-systems,代码行数:27,代码来源:sse-unaligned-class.cpp

示例8: main

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;
}
开发者ID:toejamhoney,项目名称:pin,代码行数:29,代码来源:map_syms.cpp

示例9: main

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;
}
开发者ID:andrewjinyounglee,项目名称:PerVERT,代码行数:26,代码来源:inscount_tls.cpp

示例10: main

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;
}
开发者ID:alagenchev,项目名称:school_code,代码行数:32,代码来源:calltrace.cpp

示例11: libdft_part_init

/*
 * 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;
}
开发者ID:codenote,项目名称:dftwin,代码行数:32,代码来源:libdft_api.cpp

示例12: main

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;
}
开发者ID:alagenchev,项目名称:school_code,代码行数:27,代码来源:inscount2_vregs.cpp

示例13: main

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;
}
开发者ID:mandy-nan,项目名称:EECS570,代码行数:34,代码来源:frontend.cpp

示例14: main

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;
}
开发者ID:FengXingYuXin,项目名称:SHMA,代码行数:25,代码来源:coco.cpp

示例15: main

    //! 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;
    }
开发者ID:ispras,项目名称:Triton,代码行数:55,代码来源:main.cpp


注:本文中的TRACE_AddInstrumentFunction函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。