OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-agent-impl.h" | 5 #include "src/inspector/v8-debugger-agent-impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/debug/debug-interface.h" | 9 #include "src/debug/debug-interface.h" |
10 #include "src/inspector/injected-script.h" | 10 #include "src/inspector/injected-script.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 void V8DebuggerAgentImpl::setPauseOnExceptionsImpl(int pauseState) { | 684 void V8DebuggerAgentImpl::setPauseOnExceptionsImpl(int pauseState) { |
685 m_debugger->setPauseOnExceptionsState( | 685 m_debugger->setPauseOnExceptionsState( |
686 static_cast<v8::debug::ExceptionBreakState>(pauseState)); | 686 static_cast<v8::debug::ExceptionBreakState>(pauseState)); |
687 m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState); | 687 m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState); |
688 } | 688 } |
689 | 689 |
690 Response V8DebuggerAgentImpl::evaluateOnCallFrame( | 690 Response V8DebuggerAgentImpl::evaluateOnCallFrame( |
691 const String16& callFrameId, const String16& expression, | 691 const String16& callFrameId, const String16& expression, |
692 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI, | 692 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI, |
693 Maybe<bool> silent, Maybe<bool> returnByValue, Maybe<bool> generatePreview, | 693 Maybe<bool> silent, Maybe<bool> returnByValue, Maybe<bool> generatePreview, |
694 Maybe<bool> throwOnSideEffect, std::unique_ptr<RemoteObject>* result, | 694 std::unique_ptr<RemoteObject>* result, |
695 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { | 695 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { |
696 if (!isPaused()) return Response::Error(kDebuggerNotPaused); | 696 if (!isPaused()) return Response::Error(kDebuggerNotPaused); |
697 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(), | 697 InjectedScript::CallFrameScope scope(m_inspector, m_session->contextGroupId(), |
698 callFrameId); | 698 callFrameId); |
699 Response response = scope.initialize(); | 699 Response response = scope.initialize(); |
700 if (!response.isSuccess()) return response; | 700 if (!response.isSuccess()) return response; |
701 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) | 701 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) |
702 return Response::Error("Could not find call frame with given id"); | 702 return Response::Error("Could not find call frame with given id"); |
703 | 703 |
704 if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI(); | 704 if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI(); |
705 if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); | 705 if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); |
706 | 706 |
707 v8::MaybeLocal<v8::Value> maybeResultValue = | 707 v8::MaybeLocal<v8::Value> maybeResultValue = |
708 m_pausedCallFrames[scope.frameOrdinal()]->evaluate( | 708 m_pausedCallFrames[scope.frameOrdinal()]->evaluate( |
709 toV8String(m_isolate, expression), | 709 toV8String(m_isolate, expression)); |
710 throwOnSideEffect.fromMaybe(false)); | |
711 | 710 |
712 // Re-initialize after running client's code, as it could have destroyed | 711 // Re-initialize after running client's code, as it could have destroyed |
713 // context or session. | 712 // context or session. |
714 response = scope.initialize(); | 713 response = scope.initialize(); |
715 if (!response.isSuccess()) return response; | 714 if (!response.isSuccess()) return response; |
716 return scope.injectedScript()->wrapEvaluateResult( | 715 return scope.injectedScript()->wrapEvaluateResult( |
717 maybeResultValue, scope.tryCatch(), objectGroup.fromMaybe(""), | 716 maybeResultValue, scope.tryCatch(), objectGroup.fromMaybe(""), |
718 returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, | 717 returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, |
719 exceptionDetails); | 718 exceptionDetails); |
720 } | 719 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 void V8DebuggerAgentImpl::reset() { | 1177 void V8DebuggerAgentImpl::reset() { |
1179 if (!enabled()) return; | 1178 if (!enabled()) return; |
1180 m_scheduledDebuggerStep = NoStep; | 1179 m_scheduledDebuggerStep = NoStep; |
1181 m_blackboxedPositions.clear(); | 1180 m_blackboxedPositions.clear(); |
1182 resetBlackboxedStateCache(); | 1181 resetBlackboxedStateCache(); |
1183 m_scripts.clear(); | 1182 m_scripts.clear(); |
1184 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1183 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1185 } | 1184 } |
1186 | 1185 |
1187 } // namespace v8_inspector | 1186 } // namespace v8_inspector |
OLD | NEW |