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

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

Issue 2655653003: [inspector] Expose GetPossibleBreakpoints for wasm (Closed)
Patch Set: Address comments Created 3 years, 10 months 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
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/inspector/v8-debugger-script.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 actualColumnNumber;
483 String16 debuggerBreakpointId = m_debugger->setBreakpoint( 482 String16 debuggerBreakpointId = m_debugger->setBreakpoint(
484 translatedBreakpoint, &actualLineNumber, &actualColumnNumber); 483 translatedBreakpoint, &translatedBreakpoint.line_number,
dgozman 2017/01/26 06:24:34 drive-by: it doesn't look safe to pass a part of i
Clemens Hammacher 2017/01/26 09:57:47 Yes, it looks weird. I checked that it works, but
484 &translatedBreakpoint.column_number);
485 if (debuggerBreakpointId.isEmpty()) return nullptr; 485 if (debuggerBreakpointId.isEmpty()) return nullptr;
486 486
487 // Translate back from v8 location to protocol location for the return value.
488 m_debugger->wasmTranslation()->TranslateWasmScriptLocationToProtocolLocation(
dgozman 2017/01/26 06:24:34 drive-by: why don't we pass ScriptBreakpoint* arou
Clemens Hammacher 2017/01/26 09:57:48 It's not only ScriptBreakpoint object which need t
489 &translatedBreakpoint.script_id, &translatedBreakpoint.line_number,
490 &translatedBreakpoint.column_number);
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,
494 actualColumnNumber); 499 translatedBreakpoint.line_number,
500 translatedBreakpoint.column_number);
495 } 501 }
496 502
497 Response V8DebuggerAgentImpl::searchInContent( 503 Response V8DebuggerAgentImpl::searchInContent(
498 const String16& scriptId, const String16& query, 504 const String16& scriptId, const String16& query,
499 Maybe<bool> optionalCaseSensitive, Maybe<bool> optionalIsRegex, 505 Maybe<bool> optionalCaseSensitive, Maybe<bool> optionalIsRegex,
500 std::unique_ptr<Array<protocol::Debugger::SearchMatch>>* results) { 506 std::unique_ptr<Array<protocol::Debugger::SearchMatch>>* results) {
501 v8::HandleScope handles(m_isolate); 507 v8::HandleScope handles(m_isolate);
502 ScriptsMap::iterator it = m_scripts.find(scriptId); 508 ScriptsMap::iterator it = m_scripts.find(scriptId);
503 if (it == m_scripts.end()) 509 if (it == m_scripts.end())
504 return Response::Error("No script for id: " + scriptId); 510 return Response::Error("No script for id: " + scriptId);
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 void V8DebuggerAgentImpl::reset() { 1187 void V8DebuggerAgentImpl::reset() {
1182 if (!enabled()) return; 1188 if (!enabled()) return;
1183 m_scheduledDebuggerStep = NoStep; 1189 m_scheduledDebuggerStep = NoStep;
1184 m_blackboxedPositions.clear(); 1190 m_blackboxedPositions.clear();
1185 resetBlackboxedStateCache(); 1191 resetBlackboxedStateCache();
1186 m_scripts.clear(); 1192 m_scripts.clear();
1187 m_breakpointIdToDebuggerBreakpointIds.clear(); 1193 m_breakpointIdToDebuggerBreakpointIds.clear();
1188 } 1194 }
1189 1195
1190 } // namespace v8_inspector 1196 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/inspector/v8-debugger-script.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698