• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ IMG_AddInstrumentFunction函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main(int argc, char *argv[])
{
    // Initialize pin & symbol manager
    PIN_InitSymbols();
    if( PIN_Init(argc,argv) )
    {
        return Usage();
    }
    
    // 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(Image, 0);

	// RTN_AddInstrumentFunction(Routine, 0);

	// Register ImageUnload to be called when an image is unloaded
    // IMG_AddUnloadFunction(ImageUnload, 0);

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

    // Never returns
    PIN_StartProgram();
    
    return 0;
}
开发者ID:LeeeWee,项目名称:wear-leveling,代码行数:30,代码来源:malloctrace.cpp


示例2: main

int main(INT32 argc, CHAR **argv)
{
    // Initialize the pin lock
    InitLock(&lock);

    // Initialize pin
    if (PIN_Init(argc, argv)) return Usage();
    PIN_InitSymbols();

    out = fopen(KnobOutputFile.Value().c_str(), "w");

    // Register ImageLoad to be called when each image is loaded.
    IMG_AddInstrumentFunction(ImageLoad, 0);

    // Register Analysis routines to be called when a thread begins/ends
    PIN_AddThreadStartFunction(ThreadStart, 0);
    PIN_AddThreadFiniFunction(ThreadFini, 0);

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

    // Never returns
    PIN_StartProgram();

    return 0;
}
开发者ID:gungun1010,项目名称:hidden,代码行数:26,代码来源:malloc_mt.cpp


示例3: 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,代码来源:landing_pad.cpp


示例4: 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


示例5: 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);

    cout << hex;
    cout.setf(ios::showbase);
    
    IMG_AddInstrumentFunction(Image, 0);
    PIN_AddFiniFunction(Fini, 0);

    // Never returns
    PIN_StartProgram();
    
    return 0;
}
开发者ID:alugupta,项目名称:resilient-systems,代码行数:26,代码来源:malloctrace.cpp


示例6: main

int main(int argc, char *argv[])
{
    int log_taint = 0;
    for (int i = 3; i < argc; i++) {
        if(!strcmp(argv[i], "--main-module")) {
            set_main_module();
            log_info("Whitelisted the main module\n");
        }
        else if(!strcmp(argv[i], "--range")) {
            ADDRINT start = strtoul(argv[++i], NULL, 16);
            ADDRINT end = strtoul(argv[++i], NULL, 16);
            add_instrument_range(start, end);
            log_info("Whitelisted range 0x%08x..0x%08x\n", start, end);
        }
        else if(!strcmp(argv[i], "--ins")) {
            log_info("Whitelisted mnemonic(s): %s\n", argv[++i]);
            add_instrument_instruction(argv[i]);
        }
        else if(!strcmp(argv[i], "--inside")) {
            ADDRINT start = strtoul(argv[++i], NULL, 16);
            ADDRINT end = strtoul(argv[++i], NULL, 16);
            add_instrument_inside(start, end);
            log_info("Whitelisted inside sequence 0x%08x..0x%08x\n",
                start, end);
        }
        else if(!strcmp(argv[i], "--module")) {
            add_instrument_module(argv[++i]);
            log_info("Whitelisted modules containing: %s\n", argv[i]);
        }
    }

    PIN_Init(argc, argv);
    PIN_InitSymbols();

    registers_init();
    taint_init(log_taint);

    taint_source_enable("getc");
    taint_source_enable("scanf");

    IMG_AddInstrumentFunction(&module_range_handler, NULL);
    IMG_AddInstrumentFunction(&taint_sources_handler, NULL);
    INS_AddInstrumentFunction(&insns, NULL);

    PIN_StartProgram();
    return 0;
}
开发者ID:anuragshandilya,项目名称:zecart,代码行数:47,代码来源:zecart.cpp


示例7: main

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

    logging = ! KnobReplay.Value();

    if (logging)
    {
        trace  = fopen("record_imageload_rec.out", "w");
        imgLog = fopen("imageload.log", "w");

        IMG_AddInstrumentFunction(LogImageLoad, 0);
        IMG_AddUnloadFunction    (LogImageUnload, 0);
    }
    else
    {  // Replaying
        trace  = fopen("record_imageload_play.out", "w");
        imgLog = fopen("imageload.log", "r");

        // We will handle image load operations.
        PIN_SetReplayMode (REPLAY_MODE_IMAGEOPS);
        // And then we replay the first two image load ops before we start the program.
        // We do this even before adding the image instrumentation callback, that should still work,
        // Pin should defer these and replay them inside PIN_StartProgram.
        ReplayImageEntry();
        ReplayImageEntry();

        INS_AddInstrumentFunction (InstrumentInstruction, 0);
    }

    // These Trace functions demonstrate that the events are happening, they are the client...
    IMG_AddInstrumentFunction(TraceImageLoad, 0);
    IMG_AddUnloadFunction    (TraceImageUnload, 0);

    // Register Fini to be called when the application exits
    PIN_AddFiniFunction(Fini, 0);
    
    // Start the program, never returns
    PIN_StartProgram();
    
    return 0;
}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:46,代码来源:record_imageload.cpp


示例8: main

int main( int argc, char **argv ){
  
  PIN_InitSymbols();

  if( PIN_Init(argc,argv) ) {
    return Usage();
  }

  //out_file.open(KnobOutputFile.Value().c_str(), fstream::out);
	
	
	stringstream ss(KnobThreadCount.Value());
	ss >> total_threads;

  char *out_file_name = new char[BUF_SIZE];
  out_file = new fstream*[total_threads];
  for (INT32 i = 0; i < total_threads; i++) {
    sprintf(out_file_name, "%s.%d", KnobOutputFile.Value().c_str(), i);
    //cout<< out_file_name << endl;
    out_file[i] = new fstream(out_file_name, fstream::out);
  }


  stringstream ss_count(KnobSampleRate.Value());
	ss_count >> sample_counter;

  cout << "::PINTOOL:: sample per " << sample_counter << " inst" <<  endl;

  string stdinFile = KnobStdinFile.Value();
  if(stdinFile.size() > 0) {
    assert(freopen(stdinFile.c_str(), "rt", stdin));
  }

  string isSeqProgram = KnobSeqProgram.Value();
  if(isSeqProgram.size() > 0) {
    SeqProgram = true;
  }


  CacheUtil::getInstance().initialize();
  CacheCore::getInstance().initialize(total_threads);
  

  if(!SeqProgram)	{
    PIN_AddThreadStartFunction(ThreadBegin,0);
    PIN_AddThreadFiniFunction(ThreadEnd,0);
  }


  /* initialize random seed: */
  srand (time(NULL));

  IMG_AddInstrumentFunction(Image, 0);

  PIN_AddFiniFunction(Fini, 0);
  
  PIN_StartProgram();
}
开发者ID:mejbah,项目名称:Pintools,代码行数:58,代码来源:perf_sim.cpp


示例9: main

int main(int argc, char **argv)
{
    PIN_InitSymbols();  
    if ( PIN_Init(argc, argv) )
        return -1;

    IMG_AddInstrumentFunction(process_loaded_image, 0); 
    PIN_StartProbedProgram();
}
开发者ID:gungun1010,项目名称:hidden,代码行数:9,代码来源:probestdcall.cpp


示例10: main

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

    PIN_InitSymbols();
    IMG_AddInstrumentFunction(InstrumentImage, 0);
    PIN_AddFiniFunction(AtApplicationEnd, 0);
    PIN_StartProgram();
    return 0;
}
开发者ID:andrewjinyounglee,项目名称:PerVERT,代码行数:10,代码来源:syncasynctool.cpp


示例11: main

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

    IMG_AddInstrumentFunction(OnImage, 0);

    PIN_StartProgram();
    return 0;
}
开发者ID:FengXingYuXin,项目名称:SHMA,代码行数:10,代码来源:call-app-stress-tool.cpp


示例12: main

int main(int argc, char** argv)
{
    PIN_InitSymbols();

    if(PIN_Init(argc,argv))
    {
        return Usage();
    }
    
    // Set up the events
    initialize_events();
    
    if(!KnobDisableLibraryTracing.Value())
    {
        printf("Enabling library tracing.\n");
        /* Enable library tracing. */
        IMG_AddInstrumentFunction(library_loaded_function, 0);
        IMG_AddUnloadFunction(library_unloaded_function, 0);
    }

    if(KnobEnableInitialMonitoring.Value())
    {
        printf("Enabling tracing on initialization.\n");
        event_monitoring_set(true);
    }
    
    if(KnobEnableMonitoring.Value())
    {
        long start = KnobRegionStart.Value();
        long end = KnobRegionEnd.Value();
        const char* library_name = KnobRegionName.Value().c_str();

        printf("Library name: %s\n", library_name);
        printf("0x%lx 0x%lx\n", start, end);

        region_t *r = (region_t*)malloc(sizeof(region_t));
        r->start = (void*)start;
        r->end = (void*)end;
        strncpy(r->library_name, library_name, 260);
        printf("Added %s\n", r->library_name);
        add_region_to_monitoring(r);

        event_snapshot_set(true);

        region_monitoring_enabled = true;
    }
    
    // Add instrumentation. It handles both regions and instruction monitoring so must be enabled
    INS_AddInstrumentFunction(instruction_trace, 0);

    // Start up the program to investigate.
    PIN_StartProgram();

    return 0;
}
开发者ID:blaquee,项目名称:PointyStick,代码行数:55,代码来源:main.cpp


示例13: 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


示例14: main

int main(INT32 argc, CHAR **argv)
{
    PIN_Init(argc, argv);
    PIN_InitSymbols();

    INS_AddInstrumentFunction(Instruction, 0);
    IMG_AddInstrumentFunction(ImageLoad, 0);

    PIN_StartProgram();
    return 0;
}
开发者ID:alugupta,项目名称:resilient-systems,代码行数:11,代码来源:branch_target_addr.cpp


示例15: main

int main(int argc, char *argv[])
{
    if( PIN_Init(argc,argv) )
        return Usage();
    // Next call is needed, otherwise we can't find routines by name
    PIN_InitSymbols();
    outFile = KnobOutputFile.Value().empty() ? &cout : new std::ofstream(KnobOutputFile.Value().c_str());
    IMG_AddInstrumentFunction(ImageLoad, 0);
    PIN_StartProgram();    // Never returns
    return 0;
}
开发者ID:alugupta,项目名称:resilient-systems,代码行数:11,代码来源:oper-imm.cpp


示例16: main

int main(int argc, char **argv)
{
    PIN_Init(argc, argv);
    PIN_InitSymbols();

    //PIN_AddThreadStartFunction(OnThread, 0);
    IMG_AddInstrumentFunction(Image, 0);
    PIN_AddContextChangeFunction(OnException, 0);

    PIN_StartProgram();
    return 0;
}
开发者ID:herjmoo,项目名称:research,代码行数:12,代码来源:set_fp_context_xmm_regs.cpp


示例17: main

int main(int argc, char * argv[])
{
    PIN_Init(argc, argv);
    PIN_InitSymbolsAlt( SYMBOL_INFO_MODE(UINT32(IFUNC_SYMBOLS) |  UINT32(DEBUG_OR_EXPORT_SYMBOLS)));

    IMG_AddInstrumentFunction(Image,0);
    
    // Never returns
    PIN_StartProgram();
    
    return 0;
}
开发者ID:alagenchev,项目名称:school_code,代码行数:12,代码来源:ifunc_tst.cpp


示例18: main

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

    IMG_AddInstrumentFunction(OnImage, 0);
    PIN_AddContextChangeFunction(OnSignal, 0);
    PIN_AddFiniFunction(OnExit, 0);

    PIN_StartProgram();
    return 0;
}
开发者ID:alugupta,项目名称:resilient-systems,代码行数:12,代码来源:replay-signal-tool.cpp


示例19: main

int main(int argc, char **argv)
{
    PIN_Init(argc, argv);
    PIN_InitSymbols();

    OutFile.open("iarg_tsc_probed1.out");

    IMG_AddInstrumentFunction(Image, 0);

    PIN_StartProgramProbed();
    return 0;
}
开发者ID:siddhartha100,项目名称:MBProtector,代码行数:12,代码来源:iarg_tsc_probed1.cpp


示例20: main

int main(INT32 argc, CHAR **argv)
{
    PIN_InitSymbols();
    PIN_Init(argc, argv);
    
    IMG_AddInstrumentFunction(ImgFirst, 0);
    
    // Never returns
    PIN_StartProgram();
    
    return 0;
}
开发者ID:alugupta,项目名称:resilient-systems,代码行数:12,代码来源:symOutOfBound.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IMG_GetError函数代码示例发布时间:2022-05-30
下一篇:
C++ IMG_ASSERT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap