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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 return Response::Error("Locations should contain the same scriptId"); | 449 return Response::Error("Locations should contain the same scriptId"); |
450 int line = end.fromJust()->getLineNumber(); | 450 int line = end.fromJust()->getLineNumber(); |
451 int column = end.fromJust()->getColumnNumber(0); | 451 int column = end.fromJust()->getColumnNumber(0); |
452 if (line < 0 || column < 0) | 452 if (line < 0 || column < 0) |
453 return Response::Error( | 453 return Response::Error( |
454 "end.lineNumber and end.columnNumber should be >= 0"); | 454 "end.lineNumber and end.columnNumber should be >= 0"); |
455 v8End = v8::debug::Location(line, column); | 455 v8End = v8::debug::Location(line, column); |
456 } | 456 } |
457 auto it = m_scripts.find(scriptId); | 457 auto it = m_scripts.find(scriptId); |
458 if (it == m_scripts.end()) return Response::Error("Script not found"); | 458 if (it == m_scripts.end()) return Response::Error("Script not found"); |
459 | |
460 std::vector<v8::debug::BreakLocation> v8Locations; | 459 std::vector<v8::debug::BreakLocation> v8Locations; |
461 if (!it->second->getPossibleBreakpoints( | 460 { |
462 v8Start, v8End, restrictToFunction.fromMaybe(false), &v8Locations)) { | 461 v8::HandleScope handleScope(m_isolate); |
463 return Response::InternalError(); | 462 v8::Local<v8::Context> debuggerContext = |
463 v8::debug::GetDebugContext(m_isolate); | |
464 v8::Context::Scope contextScope(debuggerContext); | |
465 v8::TryCatch tryCatch(m_isolate); | |
466 it->second->getPossibleBreakpoints( | |
jgruber
2017/05/02 07:00:23
For my understanding, why do we neither check the
kozy
2017/05/04 15:23:41
Reason of linked issue is lazy compilation of scri
jgruber
2017/05/04 15:26:39
I see, thanks for the explanation.
| |
467 v8Start, v8End, restrictToFunction.fromMaybe(false), &v8Locations); | |
464 } | 468 } |
465 | 469 |
466 *locations = protocol::Array<protocol::Debugger::BreakLocation>::create(); | 470 *locations = protocol::Array<protocol::Debugger::BreakLocation>::create(); |
467 for (size_t i = 0; i < v8Locations.size(); ++i) { | 471 for (size_t i = 0; i < v8Locations.size(); ++i) { |
468 std::unique_ptr<protocol::Debugger::BreakLocation> breakLocation = | 472 std::unique_ptr<protocol::Debugger::BreakLocation> breakLocation = |
469 protocol::Debugger::BreakLocation::create() | 473 protocol::Debugger::BreakLocation::create() |
470 .setScriptId(scriptId) | 474 .setScriptId(scriptId) |
471 .setLineNumber(v8Locations[i].GetLineNumber()) | 475 .setLineNumber(v8Locations[i].GetLineNumber()) |
472 .setColumnNumber(v8Locations[i].GetColumnNumber()) | 476 .setColumnNumber(v8Locations[i].GetColumnNumber()) |
473 .build(); | 477 .build(); |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1286 | 1290 |
1287 void V8DebuggerAgentImpl::reset() { | 1291 void V8DebuggerAgentImpl::reset() { |
1288 if (!enabled()) return; | 1292 if (!enabled()) return; |
1289 m_blackboxedPositions.clear(); | 1293 m_blackboxedPositions.clear(); |
1290 resetBlackboxedStateCache(); | 1294 resetBlackboxedStateCache(); |
1291 m_scripts.clear(); | 1295 m_scripts.clear(); |
1292 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1296 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1293 } | 1297 } |
1294 | 1298 |
1295 } // namespace v8_inspector | 1299 } // namespace v8_inspector |
OLD | NEW |