void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exceptionOrCaughtValue) { ASSERT(scriptState && !m_pausedScriptState); m_pausedScriptState = scriptState; m_currentCallStack = callFrames; InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); // If a high level pause pause reason is not already set, try to infer a reason from the debugger. if (m_breakReason == DebuggerFrontendDispatcher::Reason::Other) { switch (scriptDebugServer().reasonForPause()) { case JSC::Debugger::PausedForBreakpoint: { JSC::BreakpointID debuggerBreakpointId = scriptDebugServer().pausingBreakpointID(); if (debuggerBreakpointId != m_continueToLocationBreakpointID) { m_breakReason = DebuggerFrontendDispatcher::Reason::Breakpoint; m_breakAuxData = buildBreakpointPauseReason(debuggerBreakpointId); } break; } case JSC::Debugger::PausedForDebuggerStatement: m_breakReason = DebuggerFrontendDispatcher::Reason::DebuggerStatement; m_breakAuxData = nullptr; break; case JSC::Debugger::PausedForException: m_breakReason = DebuggerFrontendDispatcher::Reason::Exception; m_breakAuxData = buildExceptionPauseReason(exceptionOrCaughtValue, injectedScript); break; case JSC::Debugger::PausedAtStatement: case JSC::Debugger::PausedAfterCall: case JSC::Debugger::PausedBeforeReturn: case JSC::Debugger::PausedAtStartOfProgram: case JSC::Debugger::PausedAtEndOfProgram: // Pause was just stepping. Nothing to report. break; case JSC::Debugger::NotPaused: ASSERT_NOT_REACHED(); break; } } // Set $exception to the exception or caught value. if (!exceptionOrCaughtValue.hasNoValue() && !injectedScript.hasNoValue()) { injectedScript.setExceptionValue(exceptionOrCaughtValue); m_hasExceptionValue = true; } m_frontendDispatcher->paused(currentCallFrames(injectedScript), m_breakReason, m_breakAuxData); m_javaScriptPauseScheduled = false; if (m_continueToLocationBreakpointID != JSC::noBreakpointID) { scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointID); m_continueToLocationBreakpointID = JSC::noBreakpointID; } if (m_listener) m_listener->didPause(); RefPtr<Stopwatch> stopwatch = m_injectedScriptManager->inspectorEnvironment().executionStopwatch(); if (stopwatch && stopwatch->isActive()) { stopwatch->stop(); m_didPauseStopwatch = true; } }