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

C++ RTN_Valid函数代码示例

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

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



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

示例1: CountImageSecsAndRtns

// Grab some detailed information about the image, the number of SECs and RTNs
static VOID CountImageSecsAndRtns (IMG img, int *nSecs, int *nRtns)
{
    int numSecs = 0;
    int numRtns = 0;

    for (SEC sec = IMG_SecHead(img); SEC_Valid(sec); sec = SEC_Next(sec))
    {
        numSecs++;
        for (RTN rtn=SEC_RtnHead(sec); RTN_Valid(rtn); rtn = RTN_Next(rtn))
        {
            numRtns++;
        }
    }

    *nSecs = numSecs;
    *nRtns = numRtns;
}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:18,代码来源:record_imageload.cpp


示例2: Image

VOID Image(IMG img, VOID * v)
{
    for (SEC sec = IMG_SecHead(img); SEC_Valid(sec); sec = SEC_Next(sec))
    {
        for (RTN rtn = SEC_RtnHead(sec); RTN_Valid(rtn); rtn = RTN_Next(rtn))
        {
            RTN_Open(rtn);
            
            for (INS ins = RTN_InsHead(rtn); INS_Valid(ins); ins = INS_Next(ins))
            {
                sandbox.RecordIns(ins);
            }

            RTN_Close(rtn);
        }
    }
}
开发者ID:andrewjinyounglee,项目名称:PerVERT,代码行数:17,代码来源:fence.cpp


示例3: Rtn

static VOID Rtn(RTN rtn, VOID *v)
{
    if (!RTN_Valid(rtn) || RTN_Name(rtn) != watch_rtn)
    {
        return;
    }
    printf("Rtn Instrumenting %s\n", watch_rtn);
    RTN_Open(rtn);
    INS ins = RTN_InsHeadOnly(rtn);
    ASSERTX (INS_Valid(ins));
    
    INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(Emit),
                             IARG_PTR, "RTN instrumentation1",  IARG_CALL_ORDER, CALL_ORDER_FIRST+3, IARG_END);
    INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(Emit),
                             IARG_PTR, "RTN instrumentation2",  IARG_CALL_ORDER, CALL_ORDER_FIRST+3, IARG_END);
    RTN_Close(rtn);
}
开发者ID:alagenchev,项目名称:school_code,代码行数:17,代码来源:instrumentation_order9.cpp


示例4: ImageLoadCallback

static VOID ImageLoadCallback(IMG img, VOID *v)
{
    if (threadFunction == 0)
    {
        if (KnobVerbose)
            cerr << "Looking for doNothing in " << IMG_Name(img) << "\n";

        RTN rtn = RTN_FindByName (img, "doNothing");

        if (RTN_Valid(rtn))
        {
            threadFunction = RTN_Address(rtn);
            if (KnobVerbose)
                cerr << "'doNothing' at " << hex << threadFunction << dec << "\n";
        }            
    }
}
开发者ID:alagenchev,项目名称:school_code,代码行数:17,代码来源:spawntool.cpp


示例5: Trace

static VOID Trace(TRACE trace, VOID *v)
{
    RTN rtn = TRACE_Rtn(trace);
    
    if (!RTN_Valid(rtn) || RTN_Name(rtn) != watch_rtn)
    {
        return;
    }

    if (TRACE_Address(trace) == RTN_Address(rtn)) 
    {
        INS ins = BBL_InsHead(TRACE_BblHead(trace));
        INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(Emit),
                             IARG_PTR, "Trace instrumentation", IARG_CALL_ORDER, CALL_ORDER_FIRST+2, IARG_END);
        printf("Trace Instrumenting %s\n", watch_rtn);
    }
}
开发者ID:FengXingYuXin,项目名称:SHMA,代码行数:17,代码来源:instrumentation_order.cpp


示例6: ImageLoad

// Called every time a new image is loaded
// Look for routines that we want to probe
VOID ImageLoad(IMG img, VOID *v)
{
    const ANNOTATION *ann = 0;
    USIZE num = 0;

    printf("Processing %s\n", IMG_Name(img).c_str());
    
    for (SEC sec = IMG_SecHead(img); SEC_Valid(sec); sec = SEC_Next(sec))
    {
        if (SEC_Name(sec) == "MyAnnot")
        {
            ann = reinterpret_cast<const ANNOTATION*>(SEC_Data(sec));
            num = SEC_Size(sec) / sizeof(ANNOTATION);
        }
    }

    if (ann)
    {
        printf("Found annotations: \n");
        for (UINT32 i = 0; i < num; i++)
        {
            ADDRINT addr = ann[i].addr;
            ADDRINT val = ann[i].value;
            printf("\t%p %p\t", Addrint2VoidStar(addr), Addrint2VoidStar(val));
            if (PIN_IsSafeForProbedInsertion(addr))
            {
                PIN_InsertCallProbed(addr, AFUNPTR(Notification), IARG_ADDRINT, val, IARG_END);
                printf(" - OK\n");
            }
            else
            {
                printf(" - Failed\n");
            }
        }

        // Set the write line function, from the image of the annotations (i.e. the main executable).
        RTN writeRtn = RTN_FindByName(img, "write_line");
        if (RTN_Valid(writeRtn))
        {
            writeFun = (void (*)(char *))RTN_Funptr(writeRtn);
        }
    }

    printf("Completed %s\n", IMG_Name(img).c_str());
}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:47,代码来源:insert_call_probed.cpp


示例7: Instruction

void Instruction(INS ins, VOID *v)
{
    RTN rtn = INS_Rtn(ins);
    if (RTN_Valid(rtn) && ((RTN_Name(rtn) == "SegAccessRtn") || (RTN_Name(rtn) == "SegAccessStrRtn")))
    {	
    
	    REG segReg = INS_SegmentRegPrefix(ins);
	    
	    if ((segReg != REG_SEG_GS) && (segReg != REG_SEG_FS))
	    	return;
	
	    REG baseReg = (segReg == REG_SEG_GS)? REG_SEG_GS_BASE : REG_SEG_FS_BASE;
	    	
	    if (INS_RewriteMemoryAddressingToBaseRegisterOnly(ins, MEMORY_TYPE_READ, REG_INST_G0))
	    {	
	        INS_InsertCall(ins, IPOINT_BEFORE,
	                       AFUNPTR(ProcessAddress),
	                       IARG_REG_VALUE,
	                       baseReg,
	                       IARG_MEMORYREAD_EA,
	                       IARG_INST_PTR,
	                       IARG_RETURN_REGS, REG_INST_G0, IARG_END);
	    }
	    if (INS_RewriteMemoryAddressingToBaseRegisterOnly(ins, MEMORY_TYPE_WRITE, REG_INST_G1))
	    {
	        INS_InsertCall(ins, IPOINT_BEFORE,
	                       AFUNPTR(ProcessAddress),
	                       IARG_REG_VALUE,
	                       baseReg,
	                       IARG_MEMORYWRITE_EA,
	                       IARG_INST_PTR,
	                       IARG_RETURN_REGS, REG_INST_G1, IARG_END);
	    }
	    if (INS_RewriteMemoryAddressingToBaseRegisterOnly(ins, MEMORY_TYPE_READ2, REG_INST_G2))
	    {
	        INS_InsertCall(ins, IPOINT_BEFORE,
	                       AFUNPTR(ProcessAddress),
	                       IARG_REG_VALUE,
	                       baseReg,
	                       IARG_MEMORYREAD2_EA,
	                       IARG_INST_PTR,
	                       IARG_RETURN_REGS, REG_INST_G2, IARG_END);
	    }
	}
}
开发者ID:dcashman,项目名称:Coursework,代码行数:45,代码来源:swizzle_seg.cpp


示例8: ImageLoad

// This routine is executed for each image.
VOID ImageLoad(IMG img, VOID *)
{
    RTN rtn = RTN_FindByName(img, "pthread_mutex_lock");
    
    if ( RTN_Valid( rtn ))
    {
        RTN_Open(rtn);
        
        RTN_InsertCall(rtn, IPOINT_BEFORE, AFUNPTR(BeforeLock),
                       IARG_THREAD_ID, IARG_END);

        RTN_InsertCall(rtn, IPOINT_AFTER, AFUNPTR(AfterLock),
                       IARG_THREAD_ID, IARG_END);


        RTN_Close(rtn);
    }
}
开发者ID:chris-pac,项目名称:PIN-tools,代码行数:19,代码来源:ThreadTimes.cpp


示例9: Image

static VOID Image(IMG img, VOID *v)
{
    RTN rtn = RTN_FindByName(img, watch_rtn);

    if (!RTN_Valid(rtn))
    {
        return;
    }
    printf("Image Instrumenting %s\n", watch_rtn);
    RTN_Open(rtn);
    INS ins = RTN_InsHeadOnly(rtn);
    ASSERTX (INS_Valid(ins));
    
    INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(Emit),
                             IARG_PTR, "IMG instrumentation", IARG_CALL_ORDER, CALL_ORDER_FIRST, IARG_END);
    RTN_Close(rtn);
    
}
开发者ID:FengXingYuXin,项目名称:SHMA,代码行数:18,代码来源:instrumentation_order.cpp


示例10: getBaseAddress

 triton::__uint getBaseAddress(triton::__uint address) {
   RTN rtn;
   SEC sec;
   IMG img;
   PIN_LockClient();
   rtn = RTN_FindByAddress(address);
   PIN_UnlockClient();
   if (RTN_Valid(rtn)) {
     sec = RTN_Sec(rtn);
     if (SEC_Valid(sec)) {
       img = SEC_Img(sec);
       if (IMG_Valid(img)) {
         return IMG_LowAddress(img);
       }
     }
   }
   return 0;
 }
开发者ID:0xDEC0DE8,项目名称:Triton,代码行数:18,代码来源:utils.cpp


示例11: getImageName

 std::string getImageName(triton::__uint address) {
   RTN rtn;
   SEC sec;
   IMG img;
   PIN_LockClient();
   rtn = RTN_FindByAddress(address);
   PIN_UnlockClient();
   if (RTN_Valid(rtn)) {
     sec = RTN_Sec(rtn);
     if (SEC_Valid(sec)) {
       img = SEC_Img(sec);
       if (IMG_Valid(img)) {
         return IMG_Name(img);
       }
     }
   }
   return "";
 }
开发者ID:0xDEC0DE8,项目名称:Triton,代码行数:18,代码来源:utils.cpp


示例12: Ins

static VOID Ins(INS ins, VOID *v)
{
    RTN rtn = INS_Rtn(ins);
    
    if (!RTN_Valid(rtn) || RTN_Name(rtn) != watch_rtn)
    {
        return;
    }

    if (INS_Address(ins) == RTN_Address(rtn)) 
    {
        INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(Emit),
                       IARG_PTR, "Ins instrumentation1", IARG_CALL_ORDER, CALL_ORDER_FIRST+1, IARG_END);
        INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(Emit),
                       IARG_PTR, "Ins instrumentation2", IARG_CALL_ORDER, CALL_ORDER_FIRST, IARG_END);
        printf("Ins Instrumenting %s\n", watch_rtn);
    }
}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:18,代码来源:instrumentation_order10.cpp


示例13: Trace

static VOID Trace(TRACE trace, VOID *v)
{
    RTN rtn = TRACE_Rtn(trace);
    
    if (!RTN_Valid(rtn) || RTN_Name(rtn) != watch_rtn)
    {
        return;
    }

    if (TRACE_Address(trace) == RTN_Address(rtn)) 
    {
        // Pin does not support issuing an RTN_Replace from the TRACE instrumentation callback
        // This will cause Pin to terminate with an error

        RTN_Replace(rtn, AFUNPTR(WatchRtnReplacement));
    }

}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:18,代码来源:instrumentation_order23.cpp


示例14: PrintRTNs

// Prints all RTNs in a given IMG to the trace file.
// We use that file later on to see if the record and replay went the same
static VOID PrintRTNs(IMG img)
{
    for (SEC sec = IMG_SecHead(img); SEC_Valid(sec); sec = SEC_Next(sec))
    {
        if (SEC_Type(sec) != SEC_TYPE_EXEC)
        {
            continue;
        }
        for (RTN rtn=SEC_RtnHead(sec); RTN_Valid(rtn); rtn = RTN_Next(rtn))
        {
            if (RTN_IsArtificial(rtn))
            {
                continue;
            }
            fprintf(trace, "Function '%s' loaded at %llx\n", RTN_Name(rtn).c_str(), (unsigned long long)RTN_Address(rtn));
        }
    }
}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:20,代码来源:record_imageload2.cpp


示例15: Instruction

static VOID Instruction(INS ins, VOID *v)
{
    RTN rtn = INS_Rtn(ins);
    
    if (!RTN_Valid(rtn) || RTN_Name(rtn) != watch_rtn)
    {
        return;
    }

    if (INS_Address(ins) == RTN_Address(rtn)) 
    {
        // Pin does not support issuing an RTN_Replace from the INS instrumentation callback
        // This will cause Pin to terminate with an error


        RTN_Replace(rtn, AFUNPTR(WatchRtnReplacement));
    }

}
开发者ID:alagenchev,项目名称:school_code,代码行数:19,代码来源:instrumentation_order22.cpp


示例16: Instruction

// Pin calls this function every time a new instruction is encountered
VOID Instruction(INS ins, VOID *v)
{
    RTN rtn = INS_Rtn(ins);
    if (!RTN_Valid(rtn))
    {
        ++insNoRtnDiscoveredCount;
        INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)InsNoRtnCount, IARG_END);
    }
    else if (RTN_IsDynamic(rtn))
    {
        ++insDynamicDiscoveredCount;
        INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)InsDynamicCount, IARG_END);
    }
    else
    {
        ++insNativeDiscoveredCount;
        INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)InsNativeCount, IARG_END);
    }
}
开发者ID:FengXingYuXin,项目名称:SHMA,代码行数:20,代码来源:DynamicInsCount.cpp


示例17: Trace

static VOID Trace(TRACE trace, VOID *v)
{
    RTN rtn = TRACE_Rtn(trace);
    
    if (!RTN_Valid(rtn) || RTN_Name(rtn) != watch_rtn)
    {
        return;
    }

    if (TRACE_Address(trace) == RTN_Address(rtn)) 
    {
        // Pin does not support issuing an RTN_InsertCall from the TRACE instrumentation callback
        // This will cause Pin to terminate with an error
        RTN_Open(rtn);
        RTN_InsertCall(rtn, IPOINT_BEFORE, AFUNPTR(Emit),
                       IARG_PTR, "Ins instrumentation1", IARG_END);
        RTN_Close(rtn);
    }
}
开发者ID:FengXingYuXin,项目名称:SHMA,代码行数:19,代码来源:instrumentation_order15.cpp


示例18: ImageLoad

/*!
 * Test SafeCopy in the image instrumentation callback
 */
VOID ImageLoad(IMG img, VOID *v)
{
#if defined(TARGET_WINDOWS)
    // Pin on Windows inserts a probe that intercepts APCs at KiApcUserDispatcher
    RTN rtn = RTN_FindByName(img, "KiUserApcDispatcher");
    if (RTN_Valid(rtn))
    {
        probeAddr = (VOID *)RTN_Address(rtn);
    }
#endif

    static BOOL first = TRUE;
    if (first)
    {
        first = FALSE;
        out << "Test SafeCopy in the image instrumentation callback." << endl << flush;
        SafeCopyTest();
    }
}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:22,代码来源:safecopy.cpp


示例19: Target2LibName

const string& Target2LibName(ADDRINT target)
{
    PIN_LockClient();
    
    const RTN rtn = RTN_FindByAddress(target);
    static const string _invalid_rtn("[Unknown image]");

    string name;
    
    if( RTN_Valid(rtn) ) {
        name = IMG_Name(SEC_Img(RTN_Sec(rtn)));
    } else {
        name = _invalid_rtn;
    }

    PIN_UnlockClient();

    return *new string(name);
}
开发者ID:gungun1010,项目名称:hidden,代码行数:19,代码来源:Maid.cpp


示例20: Image

VOID Image(IMG img, VOID *v)
{
    if(IMG_IsMainExecutable(img))
    {
        for (SEC sec = IMG_SecHead(img); SEC_Valid(sec); sec = SEC_Next(sec))
        {
            for (RTN rtn = SEC_RtnHead(sec); RTN_Valid(rtn); rtn = RTN_Next(rtn))
            {
                if (RTN_Name(rtn) == "_NotifyPinAfterMmap" || RTN_Name(rtn) == "NotifyPinAfterMmap")
                {
                    RTN_Open(rtn);
                    RTN_InsertCall(rtn, IPOINT_BEFORE, (AFUNPTR)MmapAfter,
                    IARG_FUNCARG_ENTRYPOINT_VALUE, 0, IARG_END);
                    RTN_Close(rtn);
                }
            }
         }
    }
}
开发者ID:FengXingYuXin,项目名称:SHMA,代码行数:19,代码来源:memory_allocation_from_app_access_protection_tool.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ RTP_DEBUG_OUTPUT_INT函数代码示例发布时间:2022-05-30
下一篇:
C++ RTN_Open函数代码示例发布时间: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