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

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

Issue 2488733003: [inspector] Add exception caught/uncaught status to protocol (Closed)
Patch Set: Use Maybe version of BooleanValue Created 4 years, 1 month 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 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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 &breakpoint.condition); 1071 &breakpoint.condition);
1072 std::unique_ptr<protocol::Debugger::Location> location = resolveBreakpoint( 1072 std::unique_ptr<protocol::Debugger::Location> location = resolveBreakpoint(
1073 cookie.first, scriptId, breakpoint, UserBreakpointSource); 1073 cookie.first, scriptId, breakpoint, UserBreakpointSource);
1074 if (location) 1074 if (location)
1075 m_frontend.breakpointResolved(cookie.first, std::move(location)); 1075 m_frontend.breakpointResolved(cookie.first, std::move(location));
1076 } 1076 }
1077 } 1077 }
1078 1078
1079 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause( 1079 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(
1080 v8::Local<v8::Context> context, v8::Local<v8::Value> exception, 1080 v8::Local<v8::Context> context, v8::Local<v8::Value> exception,
1081 const std::vector<String16>& hitBreakpoints, bool isPromiseRejection) { 1081 const std::vector<String16>& hitBreakpoints, bool isPromiseRejection,
1082 bool isUncaught) {
1082 JavaScriptCallFrames callFrames = m_debugger->currentCallFrames(1); 1083 JavaScriptCallFrames callFrames = m_debugger->currentCallFrames(1);
1083 JavaScriptCallFrame* topCallFrame = 1084 JavaScriptCallFrame* topCallFrame =
1084 !callFrames.empty() ? callFrames.begin()->get() : nullptr; 1085 !callFrames.empty() ? callFrames.begin()->get() : nullptr;
1085 1086
1086 V8DebuggerAgentImpl::SkipPauseRequest result; 1087 V8DebuggerAgentImpl::SkipPauseRequest result;
1087 if (m_skipAllPauses) 1088 if (m_skipAllPauses)
1088 result = RequestContinue; 1089 result = RequestContinue;
1089 else if (!hitBreakpoints.empty()) 1090 else if (!hitBreakpoints.empty())
1090 result = RequestNoSkip; // Don't skip explicit breakpoints even if set in 1091 result = RequestNoSkip; // Don't skip explicit breakpoints even if set in
1091 // frameworks. 1092 // frameworks.
(...skipping 21 matching lines...) Expand all
1113 m_session->findInjectedScript(V8Debugger::contextId(context), 1114 m_session->findInjectedScript(V8Debugger::contextId(context),
1114 injectedScript); 1115 injectedScript);
1115 if (injectedScript) { 1116 if (injectedScript) {
1116 m_breakReason = 1117 m_breakReason =
1117 isPromiseRejection 1118 isPromiseRejection
1118 ? protocol::Debugger::Paused::ReasonEnum::PromiseRejection 1119 ? protocol::Debugger::Paused::ReasonEnum::PromiseRejection
1119 : protocol::Debugger::Paused::ReasonEnum::Exception; 1120 : protocol::Debugger::Paused::ReasonEnum::Exception;
1120 std::unique_ptr<protocol::Runtime::RemoteObject> obj; 1121 std::unique_ptr<protocol::Runtime::RemoteObject> obj;
1121 injectedScript->wrapObject(exception, kBacktraceObjectGroup, false, false, 1122 injectedScript->wrapObject(exception, kBacktraceObjectGroup, false, false,
1122 &obj); 1123 &obj);
1123 m_breakAuxData = obj ? obj->serialize() : nullptr; 1124 if (obj) {
1125 m_breakAuxData = obj->serialize();
1126 m_breakAuxData->setBoolean("uncaught", isUncaught);
dgozman 2016/11/09 16:27:48 To be very clean, we'd better pass uncaught alongs
jgruber 2016/11/10 07:55:52 Agreed, but wouldn't that break backwards compatib
1127 } else {
1128 m_breakAuxData = nullptr;
1129 }
1124 // m_breakAuxData might be null after this. 1130 // m_breakAuxData might be null after this.
1125 } 1131 }
1126 } 1132 }
1127 1133
1128 std::unique_ptr<Array<String16>> hitBreakpointIds = Array<String16>::create(); 1134 std::unique_ptr<Array<String16>> hitBreakpointIds = Array<String16>::create();
1129 1135
1130 for (const auto& point : hitBreakpoints) { 1136 for (const auto& point : hitBreakpoints) {
1131 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator 1137 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator
1132 breakpointIterator = m_serverBreakpoints.find(point); 1138 breakpointIterator = m_serverBreakpoints.find(point);
1133 if (breakpointIterator != m_serverBreakpoints.end()) { 1139 if (breakpointIterator != m_serverBreakpoints.end()) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 1224
1219 void V8DebuggerAgentImpl::reset() { 1225 void V8DebuggerAgentImpl::reset() {
1220 if (!enabled()) return; 1226 if (!enabled()) return;
1221 m_scheduledDebuggerStep = NoStep; 1227 m_scheduledDebuggerStep = NoStep;
1222 m_scripts.clear(); 1228 m_scripts.clear();
1223 m_blackboxedPositions.clear(); 1229 m_blackboxedPositions.clear();
1224 m_breakpointIdToDebuggerBreakpointIds.clear(); 1230 m_breakpointIdToDebuggerBreakpointIds.clear();
1225 } 1231 }
1226 1232
1227 } // namespace v8_inspector 1233 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.h ('k') | test/inspector/debugger/caught-uncaught-exceptions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698