Beispiel #1
0
void Debugger::Interrupt(int type, const char *program,
                         InterruptSite *site /* = NULL */,
                         const char *error /* = NULL */) {
  ASSERT(RuntimeOption::EnableDebugger);

  RequestInjectionData &rjdata = ThreadInfo::s_threadInfo->m_reqInjectionData;
  if (rjdata.debuggerIdle > 0 && type == BreakPointReached) {
    --rjdata.debuggerIdle;
    return;
  }

  DebuggerProxyPtr proxy = GetProxy();
  if (proxy) {
    if (proxy->needInterrupt() || type != BreakPointReached) {
      // Interrupts may execute some PHP code, causing another interruption.
      std::stack<void *> &interrupts = rjdata.interrupts;

      CmdInterrupt cmd((InterruptType)type, program, site, error);
      interrupts.push(&cmd);
      proxy->interrupt(cmd);
      interrupts.pop();
    }
    rjdata.debuggerIntr = proxy->needInterruptForNonBreak();
    if (!hhvm) {
      rjdata.debuggerIdle = proxy->needInterrupt() ? 0 : 1000;
    }
  } else {
    // debugger clients are disconnected abnormally
    if (type == SessionStarted || type == SessionEnded) {
      // for command line programs, we need this exception to exit from
      // the infinite execution loop
      throw DebuggerClientExitException();
    }
  }
}