Index: src/inspector/v8-debugger.cc |
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc |
index cf7dc2a2e0671d845fc33d89f7c8be1d9c6bdd85..d4951f026df6c4a642cd56806276a4b34bec7067 100644 |
--- a/src/inspector/v8-debugger.cc |
+++ b/src/inspector/v8-debugger.cc |
@@ -414,7 +414,8 @@ void V8Debugger::scheduleStepIntoAsync( |
Response V8Debugger::continueToLocation( |
int targetContextGroupId, |
- std::unique_ptr<protocol::Debugger::Location> location) { |
+ std::unique_ptr<protocol::Debugger::Location> location, |
+ const String16& strategy) { |
DCHECK(isPaused()); |
DCHECK(!m_executionState.IsEmpty()); |
DCHECK(targetContextGroupId); |
@@ -427,6 +428,15 @@ Response V8Debugger::continueToLocation( |
m_continueToLocationBreakpointId = |
setBreakpoint(breakpoint, &lineNumber, &columnNumber); |
if (!m_continueToLocationBreakpointId.isEmpty()) { |
+ m_continueToLocationStrategy = strategy; |
+ if (m_continueToLocationStrategy != |
+ protocol::Debugger::ContinueToLocation::StrategyEnum::Default) { |
+ m_continueToLocationStack = captureStackTrace(true); |
+ if (!m_continueToLocationStack) { |
dgozman
2017/05/16 20:19:24
DCHECK()
kozy
2017/05/16 21:18:48
Done.
|
+ m_continueToLocationStrategy = |
+ protocol::Debugger::ContinueToLocation::StrategyEnum::Default; |
+ } |
+ } |
continueProgram(targetContextGroupId); |
return Response::OK(); |
} else { |
@@ -434,11 +444,26 @@ Response V8Debugger::continueToLocation( |
} |
} |
-void V8Debugger::clearContinueToLocation() { |
- if (m_continueToLocationBreakpointId.length()) { |
- removeBreakpoint(m_continueToLocationBreakpointId); |
+bool V8Debugger::shouldIgnoreContinueToLocation() { |
dgozman
2017/05/16 20:19:25
shouldContinueToCurrentLocation
kozy
2017/05/16 21:18:48
Done.
|
+ if (m_continueToLocationStrategy == |
+ protocol::Debugger::ContinueToLocation::StrategyEnum::Default) { |
+ return false; |
+ } |
+ std::unique_ptr<V8StackTraceImpl> currentStack = captureStackTrace(true); |
+ if (m_continueToLocationStrategy == |
+ protocol::Debugger::ContinueToLocation::StrategyEnum::InCurrentFrame) { |
+ return !m_continueToLocationStack->isEqualIgnoringTopFrame( |
+ currentStack.get()); |
} |
+ return false; |
+} |
+ |
+void V8Debugger::clearContinueToLocation() { |
+ if (m_continueToLocationBreakpointId.isEmpty()) return; |
+ removeBreakpoint(m_continueToLocationBreakpointId); |
m_continueToLocationBreakpointId = String16(); |
+ m_continueToLocationStrategy = String16(); |
+ m_continueToLocationStack.reset(); |
} |
Response V8Debugger::setScriptSource( |
@@ -596,6 +621,11 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext, |
breakpointIds.push_back(String16::fromInteger( |
hitBreakpointNumber->Int32Value(debuggerContext()).FromJust())); |
} |
+ if (breakpointIds.size() == 1 && |
+ breakpointIds[0] == m_continueToLocationBreakpointId) { |
+ v8::Context::Scope contextScope(pausedContext); |
+ if (shouldIgnoreContinueToLocation()) return; |
+ } |
} |
clearContinueToLocation(); |