| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 "platform/v8_inspector/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/InjectedScript.h" | 7 #include "platform/v8_inspector/InjectedScript.h" |
| 8 #include "platform/v8_inspector/InspectedContext.h" | 8 #include "platform/v8_inspector/InspectedContext.h" |
| 9 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 9 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
| 10 #include "platform/v8_inspector/RemoteObjectId.h" | 10 #include "platform/v8_inspector/RemoteObjectId.h" |
| 11 #include "platform/v8_inspector/ScriptBreakpoint.h" | 11 #include "platform/v8_inspector/ScriptBreakpoint.h" |
| 12 #include "platform/v8_inspector/V8Debugger.h" | 12 #include "platform/v8_inspector/V8Debugger.h" |
| 13 #include "platform/v8_inspector/V8DebuggerScript.h" | 13 #include "platform/v8_inspector/V8DebuggerScript.h" |
| 14 #include "platform/v8_inspector/V8InspectorImpl.h" | 14 #include "platform/v8_inspector/V8InspectorImpl.h" |
| 15 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 15 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 16 #include "platform/v8_inspector/V8Regex.h" | 16 #include "platform/v8_inspector/V8Regex.h" |
| 17 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 17 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
| 18 #include "platform/v8_inspector/V8StackTraceImpl.h" | 18 #include "platform/v8_inspector/V8StackTraceImpl.h" |
| 19 #include "platform/v8_inspector/V8StringUtil.h" | 19 #include "platform/v8_inspector/V8StringUtil.h" |
| 20 #include "platform/v8_inspector/public/V8InspectorClient.h" | 20 #include "platform/v8_inspector/public/V8InspectorClient.h" |
| 21 | 21 |
| 22 #include <algorithm> | 22 #include <algorithm> |
| 23 | 23 |
| 24 using blink::protocol::Array; | 24 namespace v8_inspector { |
| 25 using blink::protocol::Maybe; | |
| 26 using blink::protocol::Debugger::BreakpointId; | |
| 27 using blink::protocol::Debugger::CallFrame; | |
| 28 using blink::protocol::Runtime::ExceptionDetails; | |
| 29 using blink::protocol::Runtime::ScriptId; | |
| 30 using blink::protocol::Runtime::StackTrace; | |
| 31 using blink::protocol::Runtime::RemoteObject; | |
| 32 | 25 |
| 33 namespace v8_inspector { | 26 using protocol::Array; |
| 27 using protocol::Maybe; |
| 28 using protocol::Debugger::BreakpointId; |
| 29 using protocol::Debugger::CallFrame; |
| 30 using protocol::Runtime::ExceptionDetails; |
| 31 using protocol::Runtime::ScriptId; |
| 32 using protocol::Runtime::StackTrace; |
| 33 using protocol::Runtime::RemoteObject; |
| 34 | 34 |
| 35 namespace DebuggerAgentState { | 35 namespace DebuggerAgentState { |
| 36 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; | 36 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; |
| 37 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; | 37 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; |
| 38 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; | 38 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; |
| 39 static const char blackboxPattern[] = "blackboxPattern"; | 39 static const char blackboxPattern[] = "blackboxPattern"; |
| 40 static const char debuggerEnabled[] = "debuggerEnabled"; | 40 static const char debuggerEnabled[] = "debuggerEnabled"; |
| 41 | 41 |
| 42 // Breakpoint properties. | 42 // Breakpoint properties. |
| 43 static const char url[] = "url"; | 43 static const char url[] = "url"; |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 | 873 |
| 874 void V8DebuggerAgentImpl::changeJavaScriptRecursionLevel(int step) | 874 void V8DebuggerAgentImpl::changeJavaScriptRecursionLevel(int step) |
| 875 { | 875 { |
| 876 if (m_javaScriptPauseScheduled && !m_skipAllPauses && !m_debugger->isPaused(
)) { | 876 if (m_javaScriptPauseScheduled && !m_skipAllPauses && !m_debugger->isPaused(
)) { |
| 877 // Do not ever loose user's pause request until we have actually paused. | 877 // Do not ever loose user's pause request until we have actually paused. |
| 878 m_debugger->setPauseOnNextStatement(true); | 878 m_debugger->setPauseOnNextStatement(true); |
| 879 } | 879 } |
| 880 if (m_scheduledDebuggerStep == StepOut) { | 880 if (m_scheduledDebuggerStep == StepOut) { |
| 881 m_recursionLevelForStepOut += step; | 881 m_recursionLevelForStepOut += step; |
| 882 if (!m_recursionLevelForStepOut) { | 882 if (!m_recursionLevelForStepOut) { |
| 883 // When StepOut crosses a task boundary (i.e. js -> blink_c++) from
where it was requested, | 883 // When StepOut crosses a task boundary (i.e. js -> c++) from where
it was requested, |
| 884 // switch stepping to step into a next JS task, as if we exited to a
blackboxed framework. | 884 // switch stepping to step into a next JS task, as if we exited to a
blackboxed framework. |
| 885 m_scheduledDebuggerStep = StepInto; | 885 m_scheduledDebuggerStep = StepInto; |
| 886 m_skipNextDebuggerStepOut = false; | 886 m_skipNextDebuggerStepOut = false; |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 if (m_recursionLevelForStepFrame) { | 889 if (m_recursionLevelForStepFrame) { |
| 890 m_recursionLevelForStepFrame += step; | 890 m_recursionLevelForStepFrame += step; |
| 891 if (!m_recursionLevelForStepFrame) { | 891 if (!m_recursionLevelForStepFrame) { |
| 892 // We have walked through a blackboxed framework and got back to whe
re we started. | 892 // We have walked through a blackboxed framework and got back to whe
re we started. |
| 893 // If there was no stepping scheduled, we should cancel the stepping
explicitly, | 893 // If there was no stepping scheduled, we should cancel the stepping
explicitly, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 { | 977 { |
| 978 v8::HandleScope handles(m_isolate); | 978 v8::HandleScope handles(m_isolate); |
| 979 String16 scriptSource = toProtocolString(script->source(m_isolate)); | 979 String16 scriptSource = toProtocolString(script->source(m_isolate)); |
| 980 if (!success) | 980 if (!success) |
| 981 script->setSourceURL(findSourceURL(scriptSource, false)); | 981 script->setSourceURL(findSourceURL(scriptSource, false)); |
| 982 if (!success) | 982 if (!success) |
| 983 script->setSourceMappingURL(findSourceMapURL(scriptSource, false)); | 983 script->setSourceMappingURL(findSourceMapURL(scriptSource, false)); |
| 984 | 984 |
| 985 std::unique_ptr<protocol::DictionaryValue> executionContextAuxData; | 985 std::unique_ptr<protocol::DictionaryValue> executionContextAuxData; |
| 986 if (!script->executionContextAuxData().isEmpty()) | 986 if (!script->executionContextAuxData().isEmpty()) |
| 987 executionContextAuxData = protocol::DictionaryValue::cast(parseJSON(scri
pt->executionContextAuxData())); | 987 executionContextAuxData = protocol::DictionaryValue::cast(protocol::pars
eJSON(script->executionContextAuxData())); |
| 988 bool isLiveEdit = script->isLiveEdit(); | 988 bool isLiveEdit = script->isLiveEdit(); |
| 989 bool hasSourceURL = script->hasSourceURL(); | 989 bool hasSourceURL = script->hasSourceURL(); |
| 990 String16 scriptId = script->scriptId(); | 990 String16 scriptId = script->scriptId(); |
| 991 String16 scriptURL = script->sourceURL(); | 991 String16 scriptURL = script->sourceURL(); |
| 992 | 992 |
| 993 const Maybe<String16>& sourceMapURLParam = script->sourceMappingURL(); | 993 const Maybe<String16>& sourceMapURLParam = script->sourceMappingURL(); |
| 994 const Maybe<protocol::DictionaryValue>& executionContextAuxDataParam(std::mo
ve(executionContextAuxData)); | 994 const Maybe<protocol::DictionaryValue>& executionContextAuxDataParam(std::mo
ve(executionContextAuxData)); |
| 995 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; | 995 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; |
| 996 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; | 996 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; |
| 997 if (success) | 997 if (success) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 { | 1158 { |
| 1159 if (!enabled()) | 1159 if (!enabled()) |
| 1160 return; | 1160 return; |
| 1161 m_scheduledDebuggerStep = NoStep; | 1161 m_scheduledDebuggerStep = NoStep; |
| 1162 m_scripts.clear(); | 1162 m_scripts.clear(); |
| 1163 m_blackboxedPositions.clear(); | 1163 m_blackboxedPositions.clear(); |
| 1164 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1164 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 } // namespace v8_inspector | 1167 } // namespace v8_inspector |
| OLD | NEW |