| 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 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1117     std::unique_ptr<protocol::Debugger::Location> location = | 1117     std::unique_ptr<protocol::Debugger::Location> location = | 
| 1118         resolveBreakpoint(cookie.first, breakpoint, UserBreakpointSource); | 1118         resolveBreakpoint(cookie.first, breakpoint, UserBreakpointSource); | 
| 1119     if (location) | 1119     if (location) | 
| 1120       m_frontend.breakpointResolved(cookie.first, std::move(location)); | 1120       m_frontend.breakpointResolved(cookie.first, std::move(location)); | 
| 1121   } | 1121   } | 
| 1122 } | 1122 } | 
| 1123 | 1123 | 
| 1124 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause( | 1124 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause( | 
| 1125     v8::Local<v8::Context> context, v8::Local<v8::Value> exception, | 1125     v8::Local<v8::Context> context, v8::Local<v8::Value> exception, | 
| 1126     const std::vector<String16>& hitBreakpoints, bool isPromiseRejection, | 1126     const std::vector<String16>& hitBreakpoints, bool isPromiseRejection, | 
| 1127     bool isUncaught) { | 1127     bool isUncaught, bool isOOMBreak) { | 
| 1128   JavaScriptCallFrames callFrames = m_debugger->currentCallFrames(1); | 1128   JavaScriptCallFrames callFrames = m_debugger->currentCallFrames(1); | 
| 1129   JavaScriptCallFrame* topCallFrame = | 1129   JavaScriptCallFrame* topCallFrame = | 
| 1130       !callFrames.empty() ? callFrames.begin()->get() : nullptr; | 1130       !callFrames.empty() ? callFrames.begin()->get() : nullptr; | 
| 1131 | 1131 | 
| 1132   V8DebuggerAgentImpl::SkipPauseRequest result; | 1132   V8DebuggerAgentImpl::SkipPauseRequest result; | 
| 1133   if (m_skipAllPauses) | 1133   if (isOOMBreak) | 
|  | 1134     result = RequestNoSkip; | 
|  | 1135   else if (m_skipAllPauses) | 
| 1134     result = RequestContinue; | 1136     result = RequestContinue; | 
| 1135   else if (!hitBreakpoints.empty()) | 1137   else if (!hitBreakpoints.empty()) | 
| 1136     result = RequestNoSkip;  // Don't skip explicit breakpoints even if set in | 1138     result = RequestNoSkip;  // Don't skip explicit breakpoints even if set in | 
| 1137                              // frameworks. | 1139                              // frameworks. | 
| 1138   else if (!exception.IsEmpty()) | 1140   else if (!exception.IsEmpty()) | 
| 1139     result = shouldSkipExceptionPause(topCallFrame); | 1141     result = shouldSkipExceptionPause(topCallFrame); | 
| 1140   else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled || | 1142   else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled || | 
| 1141            m_pausingOnNativeEvent) | 1143            m_pausingOnNativeEvent) | 
| 1142     result = shouldSkipStepPause(topCallFrame); | 1144     result = shouldSkipStepPause(topCallFrame); | 
| 1143   else | 1145   else | 
| 1144     result = RequestNoSkip; | 1146     result = RequestNoSkip; | 
| 1145 | 1147 | 
| 1146   m_skipNextDebuggerStepOut = false; | 1148   m_skipNextDebuggerStepOut = false; | 
| 1147   if (result != RequestNoSkip) return result; | 1149   if (result != RequestNoSkip) return result; | 
| 1148   // Skip pauses inside V8 internal scripts and on syntax errors. | 1150   // Skip pauses inside V8 internal scripts and on syntax errors. | 
| 1149   if (!topCallFrame) return RequestContinue; | 1151   if (!topCallFrame) return RequestContinue; | 
| 1150 | 1152 | 
| 1151   DCHECK(m_pausedContext.IsEmpty()); | 1153   DCHECK(m_pausedContext.IsEmpty()); | 
| 1152   JavaScriptCallFrames frames = m_debugger->currentCallFrames(); | 1154   JavaScriptCallFrames frames = m_debugger->currentCallFrames(); | 
| 1153   m_pausedCallFrames.swap(frames); | 1155   m_pausedCallFrames.swap(frames); | 
| 1154   m_pausedContext.Reset(m_isolate, context); | 1156   m_pausedContext.Reset(m_isolate, context); | 
| 1155   v8::HandleScope handles(m_isolate); | 1157   v8::HandleScope handles(m_isolate); | 
| 1156 | 1158 | 
| 1157   if (!exception.IsEmpty()) { | 1159   if (isOOMBreak) { | 
|  | 1160     m_breakReason = protocol::Debugger::Paused::ReasonEnum::OOM; | 
|  | 1161     m_breakAuxData = nullptr; | 
|  | 1162   } else if (!exception.IsEmpty()) { | 
| 1158     InjectedScript* injectedScript = nullptr; | 1163     InjectedScript* injectedScript = nullptr; | 
| 1159     m_session->findInjectedScript(InspectedContext::contextId(context), | 1164     m_session->findInjectedScript(InspectedContext::contextId(context), | 
| 1160                                   injectedScript); | 1165                                   injectedScript); | 
| 1161     if (injectedScript) { | 1166     if (injectedScript) { | 
| 1162       m_breakReason = | 1167       m_breakReason = | 
| 1163           isPromiseRejection | 1168           isPromiseRejection | 
| 1164               ? protocol::Debugger::Paused::ReasonEnum::PromiseRejection | 1169               ? protocol::Debugger::Paused::ReasonEnum::PromiseRejection | 
| 1165               : protocol::Debugger::Paused::ReasonEnum::Exception; | 1170               : protocol::Debugger::Paused::ReasonEnum::Exception; | 
| 1166       std::unique_ptr<protocol::Runtime::RemoteObject> obj; | 1171       std::unique_ptr<protocol::Runtime::RemoteObject> obj; | 
| 1167       injectedScript->wrapObject(exception, kBacktraceObjectGroup, false, false, | 1172       injectedScript->wrapObject(exception, kBacktraceObjectGroup, false, false, | 
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1268 | 1273 | 
| 1269 void V8DebuggerAgentImpl::reset() { | 1274 void V8DebuggerAgentImpl::reset() { | 
| 1270   if (!enabled()) return; | 1275   if (!enabled()) return; | 
| 1271   m_scheduledDebuggerStep = NoStep; | 1276   m_scheduledDebuggerStep = NoStep; | 
| 1272   m_scripts.clear(); | 1277   m_scripts.clear(); | 
| 1273   m_blackboxedPositions.clear(); | 1278   m_blackboxedPositions.clear(); | 
| 1274   m_breakpointIdToDebuggerBreakpointIds.clear(); | 1279   m_breakpointIdToDebuggerBreakpointIds.clear(); | 
| 1275 } | 1280 } | 
| 1276 | 1281 | 
| 1277 }  // namespace v8_inspector | 1282 }  // namespace v8_inspector | 
| OLD | NEW | 
|---|