當前位置: 首頁>>代碼示例>>C++>>正文


C++ Breakpoint::saved_instruction方法代碼示例

本文整理匯總了C++中Breakpoint::saved_instruction方法的典型用法代碼示例。如果您正苦於以下問題:C++ Breakpoint::saved_instruction方法的具體用法?C++ Breakpoint::saved_instruction怎麽用?C++ Breakpoint::saved_instruction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Breakpoint的用法示例。


在下文中一共展示了Breakpoint::saved_instruction方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: dissemble

void dissemble(PFBlock fb)
{
 Opcodes opcode;
 int rmode,rdata, k = 0;
 string name;
 Instruction *pi = fb->pstart;
 while (pi != end_of_code) {
    opcode = (Opcodes)pi->opcode;   
	// *add 1.2.4 HALT+data is not always a breakpoint!
    // (it is used as a NOP + <any useful tag data>)
    if (opcode == HALT) {
        if (pi->data < MAX_BREAKPOINTS) {
          Breakpoint *pb = Breakpoint::from_id(pi->data);
          Instruction ai = pb->saved_instruction();
          std::cout << "*";
          opcode = (Opcodes)ai.opcode;
          rmode = ai.rmode;  rdata = ai.data;
        } else { opcode = NOP; rdata = pi->data; }
    } else {
      rmode  = pi->rmode;  rdata  = pi->data;
    }
    name =  get_opcode_name(opcode);
    std::cout << k++ << ' ' <<  name << '\t';
    if (opcode == CCALL || opcode == CALL || opcode == CALLD || opcode == CALLN) {
       FBlock* pfb;
       void *data = data_ptr(rdata);
       if (opcode == CALLN)
           pfb = Builtin::imported_fblock_from_function((void*)((NFBlock *)data)->pfn);
       else pfb = PFBlock(data_ptr(rdata));     
      if (pfb) Function::from_fun_block(pfb)->dump(std::cout);      
    } else 
    if (opcode == JSWITCH) {
      int *swb = (int *)data_ptr(rdata);
      int sz = *swb++;
      int def = *swb++;
      std::cout << '(' << sz << ',' << def << ") ";
      for (int i = 0; i < sz; i++) std::cout << *swb++ << ' ' << *swb++ << ' ';
    }
    else
    if (opcode == TOSD || opcode == TPODS) {
       PClass pc = *(PClass *)data_ptr(rdata);
       std::cout << pc->name();
    }
    else {
     if (rmode) 
      switch(rmode) {
      case DIRECT: std::cout << "D ";  break;
      case SREL:   std::cout << "R ";  break;
      case OREL:   std::cout << "S ";  break;
     }
     if (rdata != 0) std::cout << rdata;
   }
   std::cout << std::endl;  
   if (opcode == RET || opcode == RETI || opcode == RETD) break;
   pi++;
 }
}
開發者ID:doniexun,項目名稱:UnderC,代碼行數:57,代碼來源:dissem.cpp


注:本文中的Breakpoint::saved_instruction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。