当前位置: 首页>>代码示例>>C++>>正文


C++ Proc::endVMA方法代码示例

本文整理汇总了C++中Proc::endVMA方法的典型用法代码示例。如果您正苦于以下问题:C++ Proc::endVMA方法的具体用法?C++ Proc::endVMA怎么用?C++ Proc::endVMA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Proc的用法示例。


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

示例1: begVMA

// Disassemble the instructions in each procedure
void
BinUtil::TextSeg::ctor_disassembleProcs()
{
  // ------------------------------------------------------------
  // Disassemble the instructions in each procedure.
  // ------------------------------------------------------------
  VMA sectionBase = begVMA();
  
  for (ProcVec::iterator it = m_procs.begin(); it != m_procs.end(); ++it) {
    Proc* p = *it;
    VMA procBeg = p->begVMA();
    VMA procEnd = p->endVMA();
    ushort insnSz = 0;
    VMA lastInsnVMA = procBeg; // vma of last valid instruction in the proc

    // Iterate over each vma at which an instruction might begin
    for (VMA vma = procBeg; vma < procEnd; ) {
      MachInsn *mi = &(m_contents[vma - sectionBase]);
      insnSz = LM::isa->getInsnSize(mi);
      if (insnSz == 0) {
	// This is not a recognized instruction (cf. data on CISC ISAs).
	++vma; // Increment the VMA, and try to decode again.
	continue;
      }

      int num_ops = LM::isa->getInsnNumOps(mi);
      if (num_ops == 0) {
	// This instruction contains data.  No need to decode.
	vma += insnSz;
	continue;
      }

      // We have a valid instruction at this vma!
      lastInsnVMA = vma;
      for (ushort opIndex = 0; opIndex < num_ops; opIndex++) {
        Insn *newInsn = makeInsn(m_lm->abfd(), mi, vma, opIndex, insnSz);
        m_lm->insertInsn(vma, opIndex, newInsn); 
      }
      vma += insnSz; 
    }
    // 'insnSz' is now the size of the last instruction or 0

    // Now we can update the procedure's end address and size since we
    // know where the last instruction begins.  The procedure's
    // original end address was guessed to be the begin address of the
    // following procedure while determining all procedures above.
    p->endVMA(lastInsnVMA);
    p->size(p->endVMA() - p->begVMA() + insnSz); 
  }
}
开发者ID:wjcsharp,项目名称:hpctoolkit,代码行数:51,代码来源:Seg.cpp


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