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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 729 |
730 Response V8DebuggerAgentImpl::stepOut() { | 730 Response V8DebuggerAgentImpl::stepOut() { |
731 if (!isPaused()) return Response::Error(kDebuggerNotPaused); | 731 if (!isPaused()) return Response::Error(kDebuggerNotPaused); |
732 m_scheduledDebuggerStep = StepOut; | 732 m_scheduledDebuggerStep = StepOut; |
733 m_recursionLevelForStepOut = 1; | 733 m_recursionLevelForStepOut = 1; |
734 m_session->releaseObjectGroup(kBacktraceObjectGroup); | 734 m_session->releaseObjectGroup(kBacktraceObjectGroup); |
735 m_debugger->stepOutOfFunction(); | 735 m_debugger->stepOutOfFunction(); |
736 return Response::OK(); | 736 return Response::OK(); |
737 } | 737 } |
738 | 738 |
| 739 void V8DebuggerAgentImpl::scheduleStepIntoAsync( |
| 740 std::unique_ptr<ScheduleStepIntoAsyncCallback> callback) { |
| 741 if (!isPaused()) { |
| 742 callback->sendFailure(Response::Error(kDebuggerNotPaused)); |
| 743 return; |
| 744 } |
| 745 if (m_stepIntoAsyncCallback) { |
| 746 m_stepIntoAsyncCallback->sendFailure(Response::Error( |
| 747 "Current scheduled step into async was overriden with new one.")); |
| 748 } |
| 749 m_stepIntoAsyncCallback = std::move(callback); |
| 750 } |
| 751 |
| 752 bool V8DebuggerAgentImpl::shouldBreakInScheduledAsyncTask() { |
| 753 if (!m_stepIntoAsyncCallback) return false; |
| 754 m_stepIntoAsyncCallback->sendSuccess(); |
| 755 m_stepIntoAsyncCallback.reset(); |
| 756 m_scheduledDebuggerStep = NoStep; |
| 757 v8::debug::ClearStepping(m_isolate); |
| 758 return true; |
| 759 } |
| 760 |
739 Response V8DebuggerAgentImpl::setPauseOnExceptions( | 761 Response V8DebuggerAgentImpl::setPauseOnExceptions( |
740 const String16& stringPauseState) { | 762 const String16& stringPauseState) { |
741 if (!enabled()) return Response::Error(kDebuggerNotEnabled); | 763 if (!enabled()) return Response::Error(kDebuggerNotEnabled); |
742 v8::debug::ExceptionBreakState pauseState; | 764 v8::debug::ExceptionBreakState pauseState; |
743 if (stringPauseState == "none") { | 765 if (stringPauseState == "none") { |
744 pauseState = v8::debug::NoBreakOnException; | 766 pauseState = v8::debug::NoBreakOnException; |
745 } else if (stringPauseState == "all") { | 767 } else if (stringPauseState == "all") { |
746 pauseState = v8::debug::BreakOnAnyException; | 768 pauseState = v8::debug::BreakOnAnyException; |
747 } else if (stringPauseState == "uncaught") { | 769 } else if (stringPauseState == "uncaught") { |
748 pauseState = v8::debug::BreakOnUncaughtException; | 770 pauseState = v8::debug::BreakOnUncaughtException; |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 protocol::DictionaryValue::create(); | 1241 protocol::DictionaryValue::create(); |
1220 reason->setString("reason", hitReasons[i].first); | 1242 reason->setString("reason", hitReasons[i].first); |
1221 if (hitReasons[i].second) | 1243 if (hitReasons[i].second) |
1222 reason->setObject("auxData", std::move(hitReasons[i].second)); | 1244 reason->setObject("auxData", std::move(hitReasons[i].second)); |
1223 reasons->pushValue(std::move(reason)); | 1245 reasons->pushValue(std::move(reason)); |
1224 } | 1246 } |
1225 breakAuxData = protocol::DictionaryValue::create(); | 1247 breakAuxData = protocol::DictionaryValue::create(); |
1226 breakAuxData->setArray("reasons", std::move(reasons)); | 1248 breakAuxData->setArray("reasons", std::move(reasons)); |
1227 } | 1249 } |
1228 | 1250 |
| 1251 if (m_stepIntoAsyncCallback) { |
| 1252 m_stepIntoAsyncCallback->sendFailure( |
| 1253 Response::Error("No async tasks were scheduled before pause.")); |
| 1254 m_stepIntoAsyncCallback.reset(); |
| 1255 } |
| 1256 |
1229 std::unique_ptr<Array<CallFrame>> protocolCallFrames; | 1257 std::unique_ptr<Array<CallFrame>> protocolCallFrames; |
1230 Response response = currentCallFrames(&protocolCallFrames); | 1258 Response response = currentCallFrames(&protocolCallFrames); |
1231 if (!response.isSuccess()) protocolCallFrames = Array<CallFrame>::create(); | 1259 if (!response.isSuccess()) protocolCallFrames = Array<CallFrame>::create(); |
1232 m_frontend.paused(std::move(protocolCallFrames), breakReason, | 1260 m_frontend.paused(std::move(protocolCallFrames), breakReason, |
1233 std::move(breakAuxData), std::move(hitBreakpointIds), | 1261 std::move(breakAuxData), std::move(hitBreakpointIds), |
1234 currentAsyncStackTrace()); | 1262 currentAsyncStackTrace()); |
1235 m_scheduledDebuggerStep = NoStep; | 1263 m_scheduledDebuggerStep = NoStep; |
1236 m_javaScriptPauseScheduled = false; | 1264 m_javaScriptPauseScheduled = false; |
1237 | 1265 |
1238 if (!m_continueToLocationBreakpointId.isEmpty()) { | 1266 if (!m_continueToLocationBreakpointId.isEmpty()) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 void V8DebuggerAgentImpl::reset() { | 1318 void V8DebuggerAgentImpl::reset() { |
1291 if (!enabled()) return; | 1319 if (!enabled()) return; |
1292 m_scheduledDebuggerStep = NoStep; | 1320 m_scheduledDebuggerStep = NoStep; |
1293 m_blackboxedPositions.clear(); | 1321 m_blackboxedPositions.clear(); |
1294 resetBlackboxedStateCache(); | 1322 resetBlackboxedStateCache(); |
1295 m_scripts.clear(); | 1323 m_scripts.clear(); |
1296 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1324 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1297 } | 1325 } |
1298 | 1326 |
1299 } // namespace v8_inspector | 1327 } // namespace v8_inspector |
OLD | NEW |