Exemple #1
0
CmdFlowControl::StepDestination::StepDestination(const Unit* unit,
                                                 Offset offset) :
    m_unit(unit), m_offset(offset)
{
  m_ownsInternalBreakpoint = !phpHasBreakpoint(m_unit, m_offset);
  if (m_ownsInternalBreakpoint) phpAddBreakPoint(m_unit, m_offset);
}
Exemple #2
0
// A ContSuspend is followed by code to support ContRaise, then code for
// ContSend/ContNext. We want to continue stepping on the latter. The normal
// exception handling logic will take care of the former.
// This logic is sensitive to the code gen here... we don't have access to the
// offsets for the labels used to generate this code, so we rely on the
// simplicity of the exceptional path.
void CmdNext::setupStepCont(ActRec* fp, PC pc) {
  // One byte + one byte argument
  DEBUG_ONLY auto ops = reinterpret_cast<const Op*>(pc);
  assert(ops[0] == OpContSuspend || ops[0] == OpContSuspendK);
  assert(ops[2] == OpNull); // One byte
  assert(ops[3] == OpThrow); // One byte
  assert(ops[4] == OpNull); // One byte
  Offset nextInst = fp->m_func->unit()->offsetOf(pc + 5);
  m_stepContUnit = fp->m_func->unit();
  m_stepContOffset = nextInst;
  m_stepContTag = getContinuationTag(fp);
  TRACE(2, "CmdNext: patch for cont step at '%s' offset %d\n",
        fp->m_func->fullName()->data(), nextInst);
  phpAddBreakPoint(m_stepContUnit, m_stepContOffset);
}