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

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

Issue 2531163010: [inspector] Introduce debug::WasmScript (Closed)
Patch Set: Fix expected output Created 4 years 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/inspector/v8-debugger.cc ('k') | src/inspector/v8-stack-trace-impl.cc » ('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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 static const int kMaxSkipStepFrameCount = 128; 57 static const int kMaxSkipStepFrameCount = 128;
58 static const char kBacktraceObjectGroup[] = "backtrace"; 58 static const char kBacktraceObjectGroup[] = "backtrace";
59 static const char kDebuggerNotEnabled[] = "Debugger agent is not enabled"; 59 static const char kDebuggerNotEnabled[] = "Debugger agent is not enabled";
60 static const char kDebuggerNotPaused[] = 60 static const char kDebuggerNotPaused[] =
61 "Can only perform operation while paused."; 61 "Can only perform operation while paused.";
62 62
63 namespace { 63 namespace {
64 64
65 void TranslateWasmStackTraceLocations(Array<CallFrame>* stackTrace, 65 void TranslateWasmStackTraceLocations(Array<CallFrame>* stackTrace,
66 WasmTranslation* wasmTranslation, 66 WasmTranslation* wasmTranslation) {
67 int context_group_id) {
68 for (size_t i = 0, e = stackTrace->length(); i != e; ++i) { 67 for (size_t i = 0, e = stackTrace->length(); i != e; ++i) {
69 protocol::Debugger::Location* location = stackTrace->get(i)->getLocation(); 68 protocol::Debugger::Location* location = stackTrace->get(i)->getLocation();
70 String16 scriptId = location->getScriptId(); 69 String16 scriptId = location->getScriptId();
71 int lineNumber = location->getLineNumber(); 70 int lineNumber = location->getLineNumber();
72 int columnNumber = location->getColumnNumber(-1); 71 int columnNumber = location->getColumnNumber(-1);
73 72
74 if (!wasmTranslation->TranslateWasmScriptLocationToProtocolLocation( 73 if (!wasmTranslation->TranslateWasmScriptLocationToProtocolLocation(
75 &scriptId, &lineNumber, &columnNumber, context_group_id)) { 74 &scriptId, &lineNumber, &columnNumber)) {
76 continue; 75 continue;
77 } 76 }
78 77
79 location->setScriptId(std::move(scriptId)); 78 location->setScriptId(std::move(scriptId));
80 location->setLineNumber(lineNumber); 79 location->setLineNumber(lineNumber);
81 location->setColumnNumber(columnNumber); 80 location->setColumnNumber(columnNumber);
82 } 81 }
83 } 82 }
84 83
85 String16 breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source) { 84 String16 breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source) {
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 if (!m_skippedStepFrameCount) m_recursionLevelForStepFrame = 1; 507 if (!m_skippedStepFrameCount) m_recursionLevelForStepFrame = 1;
509 508
510 ++m_skippedStepFrameCount; 509 ++m_skippedStepFrameCount;
511 return RequestStepFrame; 510 return RequestStepFrame;
512 } 511 }
513 512
514 std::unique_ptr<protocol::Debugger::Location> 513 std::unique_ptr<protocol::Debugger::Location>
515 V8DebuggerAgentImpl::resolveBreakpoint(const String16& breakpointId, 514 V8DebuggerAgentImpl::resolveBreakpoint(const String16& breakpointId,
516 const ScriptBreakpoint& breakpoint, 515 const ScriptBreakpoint& breakpoint,
517 BreakpointSource source) { 516 BreakpointSource source) {
517 v8::HandleScope handles(m_isolate);
518 DCHECK(enabled()); 518 DCHECK(enabled());
519 // FIXME: remove these checks once crbug.com/520702 is resolved. 519 // FIXME: remove these checks once crbug.com/520702 is resolved.
520 CHECK(!breakpointId.isEmpty()); 520 CHECK(!breakpointId.isEmpty());
521 CHECK(!breakpoint.script_id.isEmpty()); 521 CHECK(!breakpoint.script_id.isEmpty());
522 ScriptsMap::iterator scriptIterator = m_scripts.find(breakpoint.script_id); 522 ScriptsMap::iterator scriptIterator = m_scripts.find(breakpoint.script_id);
523 if (scriptIterator == m_scripts.end()) return nullptr; 523 if (scriptIterator == m_scripts.end()) return nullptr;
524 if (breakpoint.line_number < scriptIterator->second->startLine() || 524 if (breakpoint.line_number < scriptIterator->second->startLine() ||
525 scriptIterator->second->endLine() < breakpoint.line_number) 525 scriptIterator->second->endLine() < breakpoint.line_number)
526 return nullptr; 526 return nullptr;
527 527
528 ScriptBreakpoint translatedBreakpoint = breakpoint; 528 ScriptBreakpoint translatedBreakpoint = breakpoint;
529 if (m_scripts.count(breakpoint.script_id) == 0) { 529 m_debugger->wasmTranslation()->TranslateProtocolLocationToWasmScriptLocation(
530 m_debugger->wasmTranslation() 530 &translatedBreakpoint.script_id, &translatedBreakpoint.line_number,
531 ->TranslateProtocolLocationToWasmScriptLocation( 531 &translatedBreakpoint.column_number);
532 &translatedBreakpoint.script_id, &translatedBreakpoint.line_number,
533 &translatedBreakpoint.column_number);
534 }
535 532
536 int actualLineNumber; 533 int actualLineNumber;
537 int actualColumnNumber; 534 int actualColumnNumber;
538 String16 debuggerBreakpointId = m_debugger->setBreakpoint( 535 String16 debuggerBreakpointId = m_debugger->setBreakpoint(
539 translatedBreakpoint, &actualLineNumber, &actualColumnNumber); 536 translatedBreakpoint, &actualLineNumber, &actualColumnNumber);
540 if (debuggerBreakpointId.isEmpty()) return nullptr; 537 if (debuggerBreakpointId.isEmpty()) return nullptr;
541 538
542 m_serverBreakpoints[debuggerBreakpointId] = 539 m_serverBreakpoints[debuggerBreakpointId] =
543 std::make_pair(breakpointId, source); 540 std::make_pair(breakpointId, source);
544 CHECK(!breakpointId.isEmpty()); 541 CHECK(!breakpointId.isEmpty());
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 return Response::InternalError(); 1023 return Response::InternalError();
1027 } 1024 }
1028 } 1025 }
1029 1026
1030 std::unique_ptr<protocol::Value> protocolValue; 1027 std::unique_ptr<protocol::Value> protocolValue;
1031 Response response = toProtocolValue(debuggerContext, objects, &protocolValue); 1028 Response response = toProtocolValue(debuggerContext, objects, &protocolValue);
1032 if (!response.isSuccess()) return response; 1029 if (!response.isSuccess()) return response;
1033 protocol::ErrorSupport errorSupport; 1030 protocol::ErrorSupport errorSupport;
1034 *result = Array<CallFrame>::fromValue(protocolValue.get(), &errorSupport); 1031 *result = Array<CallFrame>::fromValue(protocolValue.get(), &errorSupport);
1035 if (!*result) return Response::Error(errorSupport.errors()); 1032 if (!*result) return Response::Error(errorSupport.errors());
1036 TranslateWasmStackTraceLocations(result->get(), m_debugger->wasmTranslation(), 1033 TranslateWasmStackTraceLocations(result->get(),
1037 m_session->contextGroupId()); 1034 m_debugger->wasmTranslation());
1038 return Response::OK(); 1035 return Response::OK();
1039 } 1036 }
1040 1037
1041 std::unique_ptr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() { 1038 std::unique_ptr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() {
1042 if (m_pausedContext.IsEmpty()) return nullptr; 1039 if (m_pausedContext.IsEmpty()) return nullptr;
1043 V8StackTraceImpl* stackTrace = m_debugger->currentAsyncCallChain(); 1040 V8StackTraceImpl* stackTrace = m_debugger->currentAsyncCallChain();
1044 return stackTrace ? stackTrace->buildInspectorObjectForTail(m_debugger) 1041 return stackTrace ? stackTrace->buildInspectorObjectForTail(m_debugger)
1045 : nullptr; 1042 : nullptr;
1046 } 1043 }
1047 1044
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 1262
1266 void V8DebuggerAgentImpl::reset() { 1263 void V8DebuggerAgentImpl::reset() {
1267 if (!enabled()) return; 1264 if (!enabled()) return;
1268 m_scheduledDebuggerStep = NoStep; 1265 m_scheduledDebuggerStep = NoStep;
1269 m_scripts.clear(); 1266 m_scripts.clear();
1270 m_blackboxedPositions.clear(); 1267 m_blackboxedPositions.clear();
1271 m_breakpointIdToDebuggerBreakpointIds.clear(); 1268 m_breakpointIdToDebuggerBreakpointIds.clear();
1272 } 1269 }
1273 1270
1274 } // namespace v8_inspector 1271 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger.cc ('k') | src/inspector/v8-stack-trace-impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698