void InspectorDebuggerAgent::getBacktrace(ErrorString* errorString, RefPtr<Array<TypeBuilder::Debugger::CallFrame> >& callFrames) { if (!assertPaused(errorString)) return; scriptDebugServer().updateCallStack(&m_currentCallStack); callFrames = currentCallFrames(); }
void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const ScriptValue& callFrames, const ScriptValue& exception) { ASSERT(scriptState && !m_pausedScriptState); m_pausedScriptState = scriptState; m_currentCallStack = callFrames; if (!exception.hasNoValue()) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); if (!injectedScript.hasNoValue()) { m_breakReason = InspectorFrontend::Debugger::Reason::Exception; m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")->openAccessors(); // m_breakAuxData might be null after this. } } m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData); m_javaScriptPauseScheduled = false; if (!m_continueToLocationBreakpointId.isEmpty()) { scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); m_continueToLocationBreakpointId = ""; } if (m_listener) m_listener->didPause(); }
void InspectorDebuggerAgent::setScriptSource(ErrorString* error, const String& scriptId, const String& newContent, const bool* const preview, RefPtr<Array<TypeBuilder::Debugger::CallFrame>>& newCallFrames, RefPtr<InspectorObject>& result) { bool previewOnly = preview && *preview; ScriptObject resultObject; if (!scriptDebugServer().setScriptSource(scriptId, newContent, previewOnly, error, &m_currentCallStack, &resultObject)) return; newCallFrames = currentCallFrames(); RefPtr<InspectorObject> object = scriptToInspectorObject(resultObject); if (object) result = object; }
void InspectorDebuggerAgent::didPause(ScriptState* scriptState) { ASSERT(scriptState && !m_pausedScriptState); m_pausedScriptState = scriptState; if (!m_breakProgramDetails) m_breakProgramDetails = InspectorObject::create(); m_breakProgramDetails->setValue("callFrames", currentCallFrames()); m_frontend->pausedScript(m_breakProgramDetails); m_javaScriptPauseScheduled = false; }
void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<InspectorObject>& result) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } injectedScript.restartFrame(errorString, m_currentCallStack, callFrameId, &result); scriptDebugServer().updateCallStack(&m_currentCallStack); newCallFrames = currentCallFrames(); }
void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<JSONObject>& result) { if (!isPaused() || m_currentCallStack.isNull()) { *errorString = "Attempt to access callframe when debugger is not on pause"; return; } InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } injectedScript.restartFrame(errorString, m_currentCallStack, callFrameId, &result); scriptDebugServer().updateCallStack(&m_currentCallStack); newCallFrames = currentCallFrames(); }
void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoints) { ASSERT(scriptState && !m_pausedScriptState); m_pausedScriptState = scriptState; m_currentCallStack = callFrames; m_skipStepInCount = numberOfStepsBeforeStepOut; if (!exception.hasNoValue()) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); if (!injectedScript.hasNoValue()) { m_breakReason = InspectorFrontend::Debugger::Reason::Exception; m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")->openAccessors(); // m_breakAuxData might be null after this. } } RefPtr<Array<String> > hitBreakpointIds = Array<String>::create(); for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBreakpoints.end(); ++i) { DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIterator = m_serverBreakpoints.find(*i); if (breakpointIterator != m_serverBreakpoints.end()) { const String& localId = breakpointIterator->value.first; hitBreakpointIds->addItem(localId); BreakpointSource source = breakpointIterator->value.second; if (m_breakReason == InspectorFrontend::Debugger::Reason::Other && source == DebugCommandBreakpointSource) m_breakReason = InspectorFrontend::Debugger::Reason::DebugCommand; } } m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData, hitBreakpointIds); m_javaScriptPauseScheduled = false; if (!m_continueToLocationBreakpointId.isEmpty()) { scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); m_continueToLocationBreakpointId = ""; } if (m_listener) m_listener->didPause(); }
void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValue& callFrames, const ScriptValue& exception) { ASSERT(scriptState && !m_pausedScriptState); m_pausedScriptState = scriptState; m_currentCallStack = callFrames; if (!exception.hasNoValue()) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); if (!injectedScript.hasNoValue()) { m_breakReason = "exception"; m_breakAuxData = injectedScript.wrapObject(exception, "backtrace"); } } m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData); m_javaScriptPauseScheduled = false; if (!m_continueToLocationBreakpointId.isEmpty()) { scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); m_continueToLocationBreakpointId = ""; } }
void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValue& callFrames, const ScriptValue& exception) { ASSERT(scriptState && !m_pausedScriptState); m_pausedScriptState = scriptState; m_currentCallStack = callFrames; if (!m_breakProgramDetails) m_breakProgramDetails = InspectorObject::create(); m_breakProgramDetails->setValue("callFrames", currentCallFrames()); if (!exception.hasNoValue()) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); if (!injectedScript.hasNoValue()) m_breakProgramDetails->setValue("exception", injectedScript.wrapObject(exception, "backtrace")); } m_frontend->paused(m_breakProgramDetails); m_javaScriptPauseScheduled = false; if (!m_continueToLocationBreakpointId.isEmpty()) { scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); m_continueToLocationBreakpointId = ""; } }
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; } }
void InspectorDebuggerAgent::editScriptSource(ErrorString* error, const String& sourceId, const String& newContent, RefPtr<InspectorArray>* newCallFrames) { if (scriptDebugServer().editScriptSource(sourceId, newContent, error, &m_currentCallStack)) *newCallFrames = currentCallFrames(); }
void InspectorDebuggerAgent::editScriptSource(const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames) { if ((*success = ScriptDebugServer::shared().editScriptSource(sourceID, newContent, *result))) *newCallFrames = currentCallFrames(); }