Filters are used to select static parts of the program to instrument. A user may only want to instrument specific routines or may way to ignore shared libraries.
The example below can be foundin InstLibExamples/filter.cpp
#include <iomanip>
#include <iostream>
#include "pin.H"
#include "instlib.H"
using namespace INSTLIB;
ofstream out("filter.out");
INT32 Usage()
{
cerr <<
"This pin tool demonstrates use of FILTER to identify instrumentation points\n"
"\n";
cerr << KNOB_BASE::StringKnobSummary() << endl;
return -1;
}
VOID Trace(
TRACE trace, VOID * val)
{
if (!filter.SelectTrace(trace))
return;
{
{
{
}
}
}
}
int main(int argc, char * argv[])
{
{
return Usage();
}
filter.Activate();
return 0;
}