本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}