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

Side by Side Diff: src/inspector/v8-debugger.cc

Issue 2879923003: [inspector] added targetCallFrames for continueToLocation (Closed)
Patch Set: added a test 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/v8-debugger.h" 5 #include "src/inspector/v8-debugger.h"
6 6
7 #include "src/inspector/debugger-script.h" 7 #include "src/inspector/debugger-script.h"
8 #include "src/inspector/inspected-context.h" 8 #include "src/inspector/inspected-context.h"
9 #include "src/inspector/protocol/Protocol.h" 9 #include "src/inspector/protocol/Protocol.h"
10 #include "src/inspector/script-breakpoint.h" 10 #include "src/inspector/script-breakpoint.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 if (m_stepIntoAsyncCallback) { 407 if (m_stepIntoAsyncCallback) {
408 m_stepIntoAsyncCallback->sendFailure(Response::Error( 408 m_stepIntoAsyncCallback->sendFailure(Response::Error(
409 "Current scheduled step into async was overriden with new one.")); 409 "Current scheduled step into async was overriden with new one."));
410 } 410 }
411 m_targetContextGroupId = targetContextGroupId; 411 m_targetContextGroupId = targetContextGroupId;
412 m_stepIntoAsyncCallback = std::move(callback); 412 m_stepIntoAsyncCallback = std::move(callback);
413 } 413 }
414 414
415 Response V8Debugger::continueToLocation( 415 Response V8Debugger::continueToLocation(
416 int targetContextGroupId, 416 int targetContextGroupId,
417 std::unique_ptr<protocol::Debugger::Location> location) { 417 std::unique_ptr<protocol::Debugger::Location> location,
418 const String16& strategy) {
418 DCHECK(isPaused()); 419 DCHECK(isPaused());
419 DCHECK(!m_executionState.IsEmpty()); 420 DCHECK(!m_executionState.IsEmpty());
420 DCHECK(targetContextGroupId); 421 DCHECK(targetContextGroupId);
421 m_targetContextGroupId = targetContextGroupId; 422 m_targetContextGroupId = targetContextGroupId;
422 ScriptBreakpoint breakpoint(location->getScriptId(), 423 ScriptBreakpoint breakpoint(location->getScriptId(),
423 location->getLineNumber(), 424 location->getLineNumber(),
424 location->getColumnNumber(0), String16()); 425 location->getColumnNumber(0), String16());
425 int lineNumber = 0; 426 int lineNumber = 0;
426 int columnNumber = 0; 427 int columnNumber = 0;
427 m_continueToLocationBreakpointId = 428 m_continueToLocationBreakpointId =
428 setBreakpoint(breakpoint, &lineNumber, &columnNumber); 429 setBreakpoint(breakpoint, &lineNumber, &columnNumber);
429 if (!m_continueToLocationBreakpointId.isEmpty()) { 430 if (!m_continueToLocationBreakpointId.isEmpty()) {
431 m_continueToLocationStrategy = strategy;
432 if (m_continueToLocationStrategy !=
433 protocol::Debugger::ContinueToLocation::StrategyEnum::Default) {
434 m_continueToLocationStack = captureStackTrace(true);
435 if (!m_continueToLocationStack) {
dgozman 2017/05/16 20:19:24 DCHECK()
kozy 2017/05/16 21:18:48 Done.
436 m_continueToLocationStrategy =
437 protocol::Debugger::ContinueToLocation::StrategyEnum::Default;
438 }
439 }
430 continueProgram(targetContextGroupId); 440 continueProgram(targetContextGroupId);
431 return Response::OK(); 441 return Response::OK();
432 } else { 442 } else {
433 return Response::Error("No breakpoint by passed location"); 443 return Response::Error("No breakpoint by passed location");
434 } 444 }
435 } 445 }
436 446
447 bool V8Debugger::shouldIgnoreContinueToLocation() {
dgozman 2017/05/16 20:19:25 shouldContinueToCurrentLocation
kozy 2017/05/16 21:18:48 Done.
448 if (m_continueToLocationStrategy ==
449 protocol::Debugger::ContinueToLocation::StrategyEnum::Default) {
450 return false;
451 }
452 std::unique_ptr<V8StackTraceImpl> currentStack = captureStackTrace(true);
453 if (m_continueToLocationStrategy ==
454 protocol::Debugger::ContinueToLocation::StrategyEnum::InCurrentFrame) {
455 return !m_continueToLocationStack->isEqualIgnoringTopFrame(
456 currentStack.get());
457 }
458 return false;
459 }
460
437 void V8Debugger::clearContinueToLocation() { 461 void V8Debugger::clearContinueToLocation() {
438 if (m_continueToLocationBreakpointId.length()) { 462 if (m_continueToLocationBreakpointId.isEmpty()) return;
439 removeBreakpoint(m_continueToLocationBreakpointId); 463 removeBreakpoint(m_continueToLocationBreakpointId);
440 }
441 m_continueToLocationBreakpointId = String16(); 464 m_continueToLocationBreakpointId = String16();
465 m_continueToLocationStrategy = String16();
466 m_continueToLocationStack.reset();
442 } 467 }
443 468
444 Response V8Debugger::setScriptSource( 469 Response V8Debugger::setScriptSource(
445 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, 470 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun,
446 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails, 471 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails,
447 JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged, 472 JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged,
448 bool* compileError) { 473 bool* compileError) {
449 class EnableLiveEditScope { 474 class EnableLiveEditScope {
450 public: 475 public:
451 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) { 476 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 std::vector<String16> breakpointIds; 614 std::vector<String16> breakpointIds;
590 if (!hitBreakpointNumbers.IsEmpty()) { 615 if (!hitBreakpointNumbers.IsEmpty()) {
591 breakpointIds.reserve(hitBreakpointNumbers->Length()); 616 breakpointIds.reserve(hitBreakpointNumbers->Length());
592 for (uint32_t i = 0; i < hitBreakpointNumbers->Length(); i++) { 617 for (uint32_t i = 0; i < hitBreakpointNumbers->Length(); i++) {
593 v8::Local<v8::Value> hitBreakpointNumber = 618 v8::Local<v8::Value> hitBreakpointNumber =
594 hitBreakpointNumbers->Get(debuggerContext(), i).ToLocalChecked(); 619 hitBreakpointNumbers->Get(debuggerContext(), i).ToLocalChecked();
595 DCHECK(hitBreakpointNumber->IsInt32()); 620 DCHECK(hitBreakpointNumber->IsInt32());
596 breakpointIds.push_back(String16::fromInteger( 621 breakpointIds.push_back(String16::fromInteger(
597 hitBreakpointNumber->Int32Value(debuggerContext()).FromJust())); 622 hitBreakpointNumber->Int32Value(debuggerContext()).FromJust()));
598 } 623 }
624 if (breakpointIds.size() == 1 &&
625 breakpointIds[0] == m_continueToLocationBreakpointId) {
626 v8::Context::Scope contextScope(pausedContext);
627 if (shouldIgnoreContinueToLocation()) return;
628 }
599 } 629 }
600 clearContinueToLocation(); 630 clearContinueToLocation();
601 631
602 m_pausedContext = pausedContext; 632 m_pausedContext = pausedContext;
603 m_executionState = executionState; 633 m_executionState = executionState;
604 m_pausedContextGroupId = contextGroupId; 634 m_pausedContextGroupId = contextGroupId;
605 agent->didPause(InspectedContext::contextId(pausedContext), exception, 635 agent->didPause(InspectedContext::contextId(pausedContext), exception,
606 breakpointIds, isPromiseRejection, isUncaught, 636 breakpointIds, isPromiseRejection, isUncaught,
607 m_scheduledOOMBreak); 637 m_scheduledOOMBreak);
608 int groupId = m_inspector->contextGroupId(pausedContext); 638 int groupId = m_inspector->contextGroupId(pausedContext);
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 fprintf(stdout, "Async stacks count: %d\n", m_asyncStacksCount); 1153 fprintf(stdout, "Async stacks count: %d\n", m_asyncStacksCount);
1124 fprintf(stdout, "Scheduled async tasks: %zu\n", m_asyncTaskStacks.size()); 1154 fprintf(stdout, "Scheduled async tasks: %zu\n", m_asyncTaskStacks.size());
1125 fprintf(stdout, "Created async tasks: %zu\n", 1155 fprintf(stdout, "Created async tasks: %zu\n",
1126 m_asyncTaskCreationStacks.size()); 1156 m_asyncTaskCreationStacks.size());
1127 fprintf(stdout, "Async tasks with parent: %zu\n", m_parentTask.size()); 1157 fprintf(stdout, "Async tasks with parent: %zu\n", m_parentTask.size());
1128 fprintf(stdout, "Recurring async tasks: %zu\n", m_recurringTasks.size()); 1158 fprintf(stdout, "Recurring async tasks: %zu\n", m_recurringTasks.size());
1129 fprintf(stdout, "\n"); 1159 fprintf(stdout, "\n");
1130 } 1160 }
1131 1161
1132 } // namespace v8_inspector 1162 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698