| Index: Source/bindings/dart/DartScriptDebugServer.cpp
|
| diff --git a/Source/bindings/dart/DartScriptDebugServer.cpp b/Source/bindings/dart/DartScriptDebugServer.cpp
|
| index 1a574b0c9f0045486950749f7ad87f446beb93ec..400bfa68c8f8f8fc126d2eff65a645e91cf84d87 100644
|
| --- a/Source/bindings/dart/DartScriptDebugServer.cpp
|
| +++ b/Source/bindings/dart/DartScriptDebugServer.cpp
|
| @@ -461,6 +461,7 @@ DartScriptDebugServer::DartScriptDebugServer()
|
| , m_breakpointsActivated(true)
|
| , m_runningNestedMessageLoop(false)
|
| , m_executionState(0)
|
| + , m_isPaused(false)
|
| , m_pausedIsolate(0)
|
| , m_pausedPage(0)
|
| , m_clientMessageLoop(0)
|
| @@ -633,6 +634,7 @@ void DartScriptDebugServer::continueProgram()
|
| if (isPaused())
|
| quitMessageLoopOnPause();
|
| m_executionState = 0;
|
| + m_isPaused = false;
|
| m_pausedIsolate = 0;
|
| }
|
|
|
| @@ -689,18 +691,40 @@ int DartScriptDebugServer::frameCount()
|
|
|
| StackTrace DartScriptDebugServer::currentCallFrames()
|
| {
|
| - return StackTrace(m_executionState);
|
| + if (!m_executionState) {
|
| + if (!Dart_CurrentIsolate())
|
| + return StackTrace();
|
| + ASSERT(!m_isPaused);
|
| + // We are not paused at a Dart breakpoint but there may be Dart frames
|
| + // on the call stack.
|
| + DartDOMData* dartDOMData = DartDOMData::current();
|
| + if (dartDOMData->stackTraceTimestampTracker()->recursionLevel() == 0)
|
| + return StackTrace();
|
| +
|
| + Dart_Handle ALLOW_UNUSED result = Dart_GetStackTrace(&m_executionState);
|
| + ASSERT(!Dart_IsError(result));
|
| + if (!m_executionState)
|
| + return StackTrace();
|
| + intptr_t length = 0;
|
| + Dart_StackTraceLength(m_executionState, &length);
|
| + if (!length) {
|
| + ASSERT_NOT_REACHED();
|
| + m_executionState = 0;
|
| + return StackTrace();
|
| + }
|
| + }
|
| + return StackTrace(m_executionState, DartUtilities::currentScriptState());
|
| }
|
|
|
| StackTrace DartScriptDebugServer::currentCallFramesForAsyncStack()
|
| {
|
| // FIXMEDART: implement propertly. These are the regular not Async call frames.
|
| - return StackTrace(m_executionState);
|
| + return StackTrace(m_executionState, DartUtilities::currentScriptState());
|
| }
|
|
|
| bool DartScriptDebugServer::isPaused()
|
| {
|
| - return !!m_executionState;
|
| + return m_isPaused;
|
| }
|
|
|
| void DartScriptDebugServer::clearCompiledScripts()
|
| @@ -961,6 +985,7 @@ DartPageDebug* DartScriptDebugServer::lookupPageDebugForCurrentIsolate()
|
| void DartScriptDebugServer::handleProgramBreak(Dart_Isolate isolate, Dart_StackTrace stackTrace, intptr_t dartBreakpointId, Dart_Handle exception, const Dart_CodeLocation& location)
|
| {
|
| ASSERT(isolate == Dart_CurrentIsolate());
|
| +
|
| // Don't allow nested breaks.
|
| if (isAnyScriptPaused())
|
| return;
|
| @@ -980,9 +1005,10 @@ void DartScriptDebugServer::handleProgramBreak(Dart_Isolate isolate, Dart_StackT
|
| Vector<String> breakpointIds;
|
| breakpointIds.append(pageDebug->lookupBreakpointId(dartBreakpointId));
|
| m_executionState = stackTrace;
|
| + m_isPaused = true;
|
| m_pausedIsolate = isolate;
|
| DartScriptState* scriptState = DartUtilities::currentScriptState();
|
| - ScriptDebugListener::SkipPauseRequest result = listener->didPause(scriptState, currentCallFrames(), exception ? DartUtilities::dartToScriptValue(exception) : ScriptValue(), breakpointIds);
|
| + ScriptDebugListener::SkipPauseRequest result = listener->didPause(scriptState, exception ? DartUtilities::dartToScriptValue(exception) : ScriptValue(), breakpointIds);
|
|
|
| if (result == ScriptDebugListener::NoSkip) {
|
| m_runningNestedMessageLoop = true;
|
| @@ -1161,9 +1187,8 @@ void UnifiedScriptDebugServer::setPauseOnExceptionsState(ScriptDebugServer::Paus
|
|
|
| void UnifiedScriptDebugServer::setPauseOnNextStatement(bool pause)
|
| {
|
| - if (isPaused()) {
|
| + if (isPaused())
|
| return;
|
| - }
|
| m_v8->setPauseOnNextStatement(pause);
|
| m_dart->setPauseOnNextStatement(pause);
|
| }
|
| @@ -1239,26 +1264,21 @@ int UnifiedScriptDebugServer::frameCount()
|
| return m_dart->frameCount();
|
| }
|
|
|
| -
|
| StackTrace UnifiedScriptDebugServer::currentCallFrames()
|
| {
|
| - // FIXMEDART: we need to figure out how to interleave stack traces where possible.
|
| - StackTrace v8StackTrace = m_v8->currentCallFrames();
|
| - if (!v8StackTrace.isNull())
|
| - return v8StackTrace;
|
| - return m_dart->currentCallFrames();
|
| + return StackTrace(m_v8->currentCallFrames(), m_dart->currentCallFrames());
|
| }
|
|
|
| StackTrace UnifiedScriptDebugServer::currentCallFramesForAsyncStack()
|
| {
|
| - // FIXMEDART: we need to figure out how to interleave stack traces where possible.
|
| + // FIXMEDART: figure out how to interleave async stack traces once we
|
| + // actually support async stack traces properly for Dart.
|
| StackTrace v8StackTrace = m_v8->currentCallFramesForAsyncStack();
|
| if (!v8StackTrace.isNull())
|
| return v8StackTrace;
|
| return m_dart->currentCallFramesForAsyncStack();
|
| }
|
|
|
| -
|
| bool UnifiedScriptDebugServer::isPaused()
|
| {
|
| return m_v8->isPaused() || m_dart->isPaused();
|
|
|