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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 DCHECK(enabled()); | 466 DCHECK(enabled()); |
467 // FIXME: remove these checks once crbug.com/520702 is resolved. | 467 // FIXME: remove these checks once crbug.com/520702 is resolved. |
468 CHECK(!breakpointId.isEmpty()); | 468 CHECK(!breakpointId.isEmpty()); |
469 CHECK(!breakpoint.script_id.isEmpty()); | 469 CHECK(!breakpoint.script_id.isEmpty()); |
470 ScriptsMap::iterator scriptIterator = m_scripts.find(breakpoint.script_id); | 470 ScriptsMap::iterator scriptIterator = m_scripts.find(breakpoint.script_id); |
471 if (scriptIterator == m_scripts.end()) return nullptr; | 471 if (scriptIterator == m_scripts.end()) return nullptr; |
472 if (breakpoint.line_number < scriptIterator->second->startLine() || | 472 if (breakpoint.line_number < scriptIterator->second->startLine() || |
473 scriptIterator->second->endLine() < breakpoint.line_number) | 473 scriptIterator->second->endLine() < breakpoint.line_number) |
474 return nullptr; | 474 return nullptr; |
475 | 475 |
| 476 // Translate from protocol location to v8 location for the debugger. |
476 ScriptBreakpoint translatedBreakpoint = breakpoint; | 477 ScriptBreakpoint translatedBreakpoint = breakpoint; |
477 m_debugger->wasmTranslation()->TranslateProtocolLocationToWasmScriptLocation( | 478 m_debugger->wasmTranslation()->TranslateProtocolLocationToWasmScriptLocation( |
478 &translatedBreakpoint.script_id, &translatedBreakpoint.line_number, | 479 &translatedBreakpoint.script_id, &translatedBreakpoint.line_number, |
479 &translatedBreakpoint.column_number); | 480 &translatedBreakpoint.column_number); |
480 | 481 |
481 int actualLineNumber; | 482 int actualLineNumber; |
482 int actualColumnNumber; | 483 int actualColumnNumber; |
483 String16 debuggerBreakpointId = m_debugger->setBreakpoint( | 484 String16 debuggerBreakpointId = m_debugger->setBreakpoint( |
484 translatedBreakpoint, &actualLineNumber, &actualColumnNumber); | 485 translatedBreakpoint, &actualLineNumber, &actualColumnNumber); |
485 if (debuggerBreakpointId.isEmpty()) return nullptr; | 486 if (debuggerBreakpointId.isEmpty()) return nullptr; |
486 | 487 |
| 488 // Translate back from v8 location to protocol location for the return value. |
| 489 m_debugger->wasmTranslation()->TranslateWasmScriptLocationToProtocolLocation( |
| 490 &translatedBreakpoint.script_id, &actualLineNumber, &actualColumnNumber); |
| 491 |
487 m_serverBreakpoints[debuggerBreakpointId] = | 492 m_serverBreakpoints[debuggerBreakpointId] = |
488 std::make_pair(breakpointId, source); | 493 std::make_pair(breakpointId, source); |
489 CHECK(!breakpointId.isEmpty()); | 494 CHECK(!breakpointId.isEmpty()); |
490 | 495 |
491 m_breakpointIdToDebuggerBreakpointIds[breakpointId].push_back( | 496 m_breakpointIdToDebuggerBreakpointIds[breakpointId].push_back( |
492 debuggerBreakpointId); | 497 debuggerBreakpointId); |
493 return buildProtocolLocation(translatedBreakpoint.script_id, actualLineNumber, | 498 return buildProtocolLocation(translatedBreakpoint.script_id, actualLineNumber, |
494 actualColumnNumber); | 499 actualColumnNumber); |
495 } | 500 } |
496 | 501 |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 void V8DebuggerAgentImpl::reset() { | 1186 void V8DebuggerAgentImpl::reset() { |
1182 if (!enabled()) return; | 1187 if (!enabled()) return; |
1183 m_scheduledDebuggerStep = NoStep; | 1188 m_scheduledDebuggerStep = NoStep; |
1184 m_blackboxedPositions.clear(); | 1189 m_blackboxedPositions.clear(); |
1185 resetBlackboxedStateCache(); | 1190 resetBlackboxedStateCache(); |
1186 m_scripts.clear(); | 1191 m_scripts.clear(); |
1187 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1192 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1188 } | 1193 } |
1189 | 1194 |
1190 } // namespace v8_inspector | 1195 } // namespace v8_inspector |
OLD | NEW |