2013-05-21 50 views
0

我正在使用名爲Intel Pin的稱爲二進制儀器的工具。不過,我在查看Pin附帶的部分示例時遇到了這個奇怪的術語。下面是相關的部分:什麼是Pc物化?

VOID CallTrace(TRACE trace, INS ins) 
{ 
    if (!KnobTraceCalls) 
     return; 

    if (INS_IsCall(ins) && !INS_IsDirectBranchOrCall(ins)) 
    { 
     // Indirect call 
     string s = "Call " + FormatAddress(INS_Address(ins), TRACE_Rtn(trace)); 
     s += " -> "; 

     INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(EmitIndirectCall), IARG_THREAD_ID, 
         IARG_PTR, new string(s), IARG_BRANCH_TARGET_ADDR, 
         IARG_G_ARG0_CALLER, IARG_G_ARG1_CALLER, IARG_END); 
    } 
    else if (INS_IsDirectBranchOrCall(ins)) 
    { 
     // Is this a tail call? 
     RTN sourceRtn = TRACE_Rtn(trace); 
     RTN destRtn = RTN_FindByAddress(INS_DirectBranchOrCallTargetAddress(ins)); 

     if (INS_IsCall(ins)   // conventional call 
      || sourceRtn != destRtn // tail call 
     ) 
     { 
      BOOL tailcall = !INS_IsCall(ins); 

      string s = ""; 
      if (tailcall) 
      { 
       s += "Tailcall "; 
      } 
      else 
      { 
       if(INS_IsProcedureCall(ins)) 
        s += "Call "; 
       else 
       { 
        s += "PcMaterialization "; 
        tailcall=1; 
       } 

      } 

      //s += INS_Mnemonic(ins) + " "; 

      s += FormatAddress(INS_Address(ins), TRACE_Rtn(trace)); 
      s += " -> "; 

      ADDRINT target = INS_DirectBranchOrCallTargetAddress(ins); 

      s += FormatAddress(target, RTN_FindByAddress(target)); 

      INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(EmitDirectCall), 
          IARG_THREAD_ID, IARG_PTR, new string(s), IARG_BOOL, tailcall, 
          IARG_G_ARG0_CALLER, IARG_G_ARG1_CALLER, IARG_END); 
     } 
    } 
    else if (INS_IsRet(ins)) 
    { 
     RTN rtn = TRACE_Rtn(trace); 

#if defined(TARGET_LINUX) && defined(TARGET_IA32) 
//  if(RTN_Name(rtn) == "_dl_debug_state") return; 
     if(RTN_Valid(rtn) && RTN_Name(rtn) == "_dl_runtime_resolve") return; 
#endif 
     string tracestring = "Return " + FormatAddress(INS_Address(ins), rtn); 
     INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(EmitReturn), 
         IARG_THREAD_ID, IARG_PTR, new string(tracestring), IARG_G_RESULT0, IARG_END); 
    } 
} 

此方法確定什麼是真正的指令執行(直接調用,間接調用,尾調用,返回和未知的PC物化)。

這裏是full code

那麼這意味着什麼呢?我嘗試了谷歌搜索 - 沒有相關的結果。

回答

3

BOOL LEVEL_CORE :: INS_IsPcMaterialization(INS INS)

返回: true,如果這是下一條指令的電話,這是一個成語物化指令指針

Check it

+0

燦」我相信我錯過了......只有我知道我現在感覺到多麼愚蠢:D謝謝! – lekroif

+0

當然,時間限制結束後 – lekroif