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

Unified Diff: src/inspector/v8-debugger.cc

Issue 2879923003: [inspector] added targetCallFrames for continueToLocation (Closed)
Patch Set: ac Created 3 years, 7 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
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | src/inspector/v8-debugger-agent-impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-debugger.cc
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
index e9204a04d41972a3122e349f350a55550beb6802..86a48401a65107d85e9e11dee827088eb15ba987 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& targetCallFrames) {
DCHECK(isPaused());
DCHECK(!m_executionState.IsEmpty());
DCHECK(targetContextGroupId);
@@ -427,6 +428,12 @@ Response V8Debugger::continueToLocation(
m_continueToLocationBreakpointId =
setBreakpoint(breakpoint, &lineNumber, &columnNumber);
if (!m_continueToLocationBreakpointId.isEmpty()) {
+ m_continueToLocationTargetCallFrames = targetCallFrames;
+ if (m_continueToLocationTargetCallFrames !=
+ protocol::Debugger::ContinueToLocation::TargetCallFramesEnum::Any) {
+ m_continueToLocationStack = captureStackTrace(true);
+ DCHECK(m_continueToLocationStack);
+ }
continueProgram(targetContextGroupId);
// TODO(kozyatinskiy): Return actual line and column number.
return Response::OK();
@@ -435,11 +442,26 @@ Response V8Debugger::continueToLocation(
}
}
-void V8Debugger::clearContinueToLocation() {
- if (m_continueToLocationBreakpointId.length()) {
- removeBreakpoint(m_continueToLocationBreakpointId);
- m_continueToLocationBreakpointId = String16();
+bool V8Debugger::shouldContinueToCurrentLocation() {
+ if (m_continueToLocationTargetCallFrames ==
+ protocol::Debugger::ContinueToLocation::TargetCallFramesEnum::Any) {
+ return true;
}
+ std::unique_ptr<V8StackTraceImpl> currentStack = captureStackTrace(true);
+ if (m_continueToLocationTargetCallFrames ==
+ protocol::Debugger::ContinueToLocation::TargetCallFramesEnum::Current) {
+ return m_continueToLocationStack->isEqualIgnoringTopFrame(
+ currentStack.get());
+ }
+ return true;
+}
+
+void V8Debugger::clearContinueToLocation() {
+ if (m_continueToLocationBreakpointId.isEmpty()) return;
+ removeBreakpoint(m_continueToLocationBreakpointId);
+ m_continueToLocationBreakpointId = String16();
+ m_continueToLocationTargetCallFrames = String16();
+ m_continueToLocationStack.reset();
}
Response V8Debugger::setScriptSource(
@@ -597,6 +619,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 (!shouldContinueToCurrentLocation()) return;
+ }
}
clearContinueToLocation();
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | src/inspector/v8-debugger-agent-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698