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

    follow.Activate();

    // Use the same prefix as our command line
    follow.SetPrefix(argv);
    
    // Start the program, never returns
    PIN_StartProgram();
    
    return 0;
}
Пример #2
0
/*!
 * 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( PIN_Init(argc,argv) )
    {
        return Usage();
    }

    // Register function to be called to instrument instructionss
    TRACE_AddInstrumentFunction(Trace, 0);

    // Register function to be called for every thread before it starts running
    PIN_AddThreadStartFunction(ThreadStart, 0);

    // Register function to be called when the application exits
    PIN_AddFiniFunction(Fini, 0);
    
    follow.Activate();

    // Use the same prefix as our command line
    follow.SetPrefix(argv);

    cerr <<  "===============================================" << endl;
    cerr <<  "This application is instrumented by InstFootprintStat" << endl;
    if (!KnobOutputFile.Value().empty()) 
    {
        cerr << "See file " << KnobOutputFile.Value() << " for analysis results" << endl;
    }
    cerr <<  "===============================================" << endl;

    PIN_InitSymbols();
    // Start the program, never returns
    PIN_StartProgram();
    
    return 0;
}