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


C++ FILTER::Activate方法代码示例

本文整理汇总了C++中FILTER::Activate方法的典型用法代码示例。如果您正苦于以下问题:C++ FILTER::Activate方法的具体用法?C++ FILTER::Activate怎么用?C++ FILTER::Activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FILTER的用法示例。


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

示例1: main

/*!
 * The main procedure of the tool.
 * This function is called when the application image is loaded but not yet started.
 * @param[in]   argc            total number of elements in the argv array
 * @param[in]   argv            array of command line arguments, 
 *                              including pin -t <toolname> -- ...
 */
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( unlikely(PIN_Init(argc,argv) ))
    {
        return Usage();
    }
    
    // Initialize the memory reference buffer;
    // set up the callback to process the buffer.
    //
    bufId = PIN_DefineTraceBuffer(sizeof(struct TRACEREF), KnobNumPagesInBuffer,
                                  BufferFull, 0);

    if(unlikely(bufId == BUFFER_ID_INVALID))
    {
        cerr << "Error: could not allocate initial buffer" << endl;
        return 1;
    }

   // Obtain  a key for TLS storage.
    mlog_key = PIN_CreateThreadDataKey(0);

    CODECACHE_AddCacheInitFunction(LimitTraces, 0);

    thread_ctx_ptr = PIN_ClaimToolRegister();
    ScratchReg = PIN_ClaimToolRegister();
    if (unlikely(!(REG_valid(thread_ctx_ptr) && REG_valid(ScratchReg))))
    {
        std::cerr << "Cannot allocate a scratch register.\n";
        std::cerr << std::flush;
        return 1;
    }


    // add callbacks
    PIN_AddThreadStartFunction(ThreadStart, 0);
    PIN_AddThreadFiniFunction(ThreadFini, 0);
    
    
        // add an instrumentation function
    TRACE_AddInstrumentFunction(Trace, 0);
    
    filter.Activate();

    // Start the program, never returns
    PIN_StartProgram();
    
    return 0;
}
开发者ID:BinCFP2016,项目名称:BinCFP,代码行数:58,代码来源:traceNum2.cpp

示例2: main

int main(int argc, char *argv[])
{

    // Initialize pin & symbol manager
    PIN_InitSymbols();
    if( PIN_Init(argc,argv) )
    {
        return Usage();
    }
    
    inputFile.open(KnobInputFile.Value().c_str());
    if(buildFuncList(inputFile))
	return Usage();

    if(strlen(KnobScriptPath.Value().c_str()) > 0)
    {
	scriptProvided = TRUE;

	int cmdLen = strlen(KnobScriptPath.Value().c_str()) + 2 + MAX_PID_DIGITS;
	scriptCMDPartI = (char*)malloc(cmdLen);
	if(scriptCMDPartI == NULL)
	{
	    cerr << "Couldn't malloc " << endl;
	    exit(-1);
	}
	snprintf(scriptCMDPartI, cmdLen, "%s %d", KnobScriptPath.Value().c_str(), getpid());
    }

    /* Register Image to be called to instrument functions.*/
    IMG_AddInstrumentFunction(Image, 0);

    /* Register Analysis routines to be called when a thread begins/ends */
    PIN_AddThreadStartFunction(ThreadStart, 0);
    PIN_AddThreadFiniFunction(ThreadFini, 0);
    
    /* Register the application-start function */
    PIN_AddApplicationStartFunction(ApplicationStart, 0);

    filter.Activate();

    /* Never returns */
    PIN_StartProgram();
    
    return 0;
    
}
开发者ID:fedorova,项目名称:vividperf,代码行数:46,代码来源:straggler-catcher.cpp

示例3: main

// argc, argv are the entire command line, including pin -t <toolname> -- ...
int main(int argc, char * argv[])
{
    if( PIN_Init(argc,argv) )
    {
        return Usage();
    }

    out.open(KnobOutputFile.Value().c_str());

    TRACE_AddInstrumentFunction(Trace, 0);

    filter.Activate();

    PIN_AddFiniFunction(Fini, NULL);

    // Start the program, never returns
    PIN_StartProgram();
    return 0;
}
开发者ID:siddhartha100,项目名称:MBProtector,代码行数:20,代码来源:filter.cpp

示例4: main

/*
 Initialize and begin program execution under the control of Pin
*/
int main(INT32 argc, CHAR **argv)
{
    if( PIN_Init(argc,argv) )
    {
        return Usage();
    }
    
    CODECACHE_AddCacheInitFunction(LimitTraces, 0);
    
    TRACE_AddInstrumentFunction(Trace, 0);

    PIN_AddFiniFunction(DumpTraceInfo, 0);
    
    filter.Activate();
    
    PIN_StartProgram();
    
    return 0;
}
开发者ID:BinCFP2016,项目名称:BinCFP,代码行数:22,代码来源:traceusage2.cpp

示例5: main

int main(int argc, char * argv[])
{
    // Initialize pin
    if (PIN_Init(argc, argv)) return Usage();

    trace = fopen("cjmp-sequence.out", "w");

    // 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);
    
    filter.Activate();
    
    // Start the program, never returns
    PIN_StartProgram();
    
    return 0;
}
开发者ID:chubbymaggie,项目名称:bincfp,代码行数:20,代码来源:cjmp-sequence.cpp


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