void ScriptDebugServer::pauseIfNeeded(JSGlobalObject* dynamicGlobalObject) { if (m_paused) return; if (!getListenersForGlobalObject(dynamicGlobalObject)) return; bool pauseNow = m_pauseOnNextStatement; pauseNow |= (m_pauseOnCallFrame == m_currentCallFrame); pauseNow |= hasBreakpoint(m_currentCallFrame->sourceID(), m_currentCallFrame->position()); m_lastExecutedLine = m_currentCallFrame->position().m_line.zeroBasedInt(); if (!pauseNow) return; m_pauseOnCallFrame = 0; m_pauseOnNextStatement = false; m_paused = true; dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, dynamicGlobalObject); didPause(dynamicGlobalObject); TimerBase::fireTimersInNestedEventLoop(); m_runningNestedMessageLoop = true; m_doneProcessingDebuggerEvents = false; runEventLoopWhilePaused(); m_runningNestedMessageLoop = false; didContinue(dynamicGlobalObject); dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, dynamicGlobalObject); m_paused = false; }
void ScriptDebugServer::handlePause(Debugger::ReasonForPause, JSGlobalObject* vmEntryGlobalObject) { dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, vmEntryGlobalObject); didPause(vmEntryGlobalObject); m_doneProcessingDebuggerEvents = false; runEventLoopWhilePaused(); didContinue(vmEntryGlobalObject); dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, vmEntryGlobalObject); }
void ScriptDebugServer::handlePause(Debugger::ReasonForPause, JSGlobalObject* vmEntryGlobalObject) { dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, vmEntryGlobalObject); didPause(vmEntryGlobalObject); TimerBase::fireTimersInNestedEventLoop(); m_runningNestedMessageLoop = true; m_doneProcessingDebuggerEvents = false; runEventLoopWhilePaused(); m_runningNestedMessageLoop = false; didContinue(vmEntryGlobalObject); dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, vmEntryGlobalObject); }
void ScriptDebugServer::pauseIfNeeded(CallFrame* callFrame) { if (m_paused) return; JSGlobalObject* dynamicGlobalObject = callFrame->dynamicGlobalObject(); if (!getListenersForGlobalObject(dynamicGlobalObject)) return; ScriptBreakpoint breakpoint; bool didHitBreakpoint = false; bool pauseNow = m_pauseOnNextStatement; pauseNow |= (m_pauseOnCallFrame == m_currentCallFrame); intptr_t sourceId = DebuggerCallFrame::sourceIdForCallFrame(m_currentCallFrame); TextPosition position = DebuggerCallFrame::positionForCallFrame(m_currentCallFrame); pauseNow |= didHitBreakpoint = hasBreakpoint(sourceId, position, &breakpoint); m_lastExecutedLine = position.m_line.zeroBasedInt(); if (!pauseNow) return; DebuggerCallFrameScope debuggerCallFrameScope(*this); if (didHitBreakpoint) { evaluateBreakpointActions(breakpoint); if (breakpoint.autoContinue) return; } m_pauseOnCallFrame = 0; m_pauseOnNextStatement = false; m_paused = true; dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, dynamicGlobalObject); didPause(dynamicGlobalObject); TimerBase::fireTimersInNestedEventLoop(); m_runningNestedMessageLoop = true; m_doneProcessingDebuggerEvents = false; runEventLoopWhilePaused(); m_runningNestedMessageLoop = false; didContinue(dynamicGlobalObject); dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, dynamicGlobalObject); m_paused = false; }