Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Unified Diff: Source/bindings/dart/DartScriptDebugServer.cpp

Issue 466243002: Support merged Dart-JS callstacks (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/dart/DartScriptDebugServer.cpp
diff --git a/Source/bindings/dart/DartScriptDebugServer.cpp b/Source/bindings/dart/DartScriptDebugServer.cpp
index 1a574b0c9f0045486950749f7ad87f446beb93ec..25f7ee539a2756509a63f473c01d9092d92979b3 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,43 @@ int DartScriptDebugServer::frameCount()
StackTrace DartScriptDebugServer::currentCallFrames()
{
- return StackTrace(m_executionState);
+ return StackTrace(m_peer->currentCallFramesForVm(), currentCallFramesForVm());
+}
+
+StackTrace DartScriptDebugServer::currentCallFramesForVm()
+{
+ if (!m_executionState && Dart_CurrentIsolate()) {
+ 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();
vsm 2014/08/13 14:26:45 Will this ever be NULL if Dart_CurrentIsolate is n
Jacob 2014/08/13 21:36:15 It won't be null. Removed that check. There are pl
+ if (!dartDOMData || 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);
+ ASSERT(length);
vsm 2014/08/13 14:26:45 nit: you could drop an ASSERT_NOT_REACHED() into t
Jacob 2014/08/13 21:36:15 Done.
+ if (!length) {
+ 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 +988,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,6 +1008,7 @@ 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);
@@ -1161,9 +1190,8 @@ void UnifiedScriptDebugServer::setPauseOnExceptionsState(ScriptDebugServer::Paus
void UnifiedScriptDebugServer::setPauseOnNextStatement(bool pause)
{
- if (isPaused()) {
+ if (isPaused())
return;
- }
m_v8->setPauseOnNextStatement(pause);
m_dart->setPauseOnNextStatement(pause);
}
@@ -1240,18 +1268,20 @@ int UnifiedScriptDebugServer::frameCount()
}
+StackTrace UnifiedScriptDebugServer::currentCallFramesForVm()
+{
+ return currentCallFrames();
+}
+
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->currentCallFramesForVm(), m_dart->currentCallFramesForVm());
}
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;

Powered by Google App Engine
This is Rietveld 408576698