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

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

Issue 2493773003: [inspector] Introduce translation of wasm frames (Closed)
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
Index: src/inspector/v8-debugger-agent-impl.cc
diff --git a/src/inspector/v8-debugger-agent-impl.cc b/src/inspector/v8-debugger-agent-impl.cc
index 3e1174e8a1ed394730e35c822f26b12ea5b6c301..dc2ae23ae99f7df748960d961da2ca61b10de333 100644
--- a/src/inspector/v8-debugger-agent-impl.cc
+++ b/src/inspector/v8-debugger-agent-impl.cc
@@ -120,7 +120,8 @@ V8DebuggerAgentImpl::V8DebuggerAgentImpl(
m_skippedStepFrameCount(0),
m_recursionLevelForStepOut(0),
m_recursionLevelForStepFrame(0),
- m_skipAllPauses(false) {
+ m_skipAllPauses(false),
+ m_wasmTranslation(m_isolate, this) {
clearBreakDetails();
}
@@ -187,6 +188,7 @@ Response V8DebuggerAgentImpl::disable() {
m_state->remove(DebuggerAgentState::blackboxPattern);
m_enabled = false;
m_state->setBoolean(DebuggerAgentState::debuggerEnabled, false);
+ m_wasmTranslation.Clear();
return Response::OK();
}
@@ -503,10 +505,13 @@ V8DebuggerAgentImpl::resolveBreakpoint(const String16& breakpointId,
scriptIterator->second->endLine() < breakpoint.line_number)
return nullptr;
+ ScriptBreakpoint translatedBreakpoint(breakpoint);
+ m_wasmTranslation.TranslateBack(&translatedBreakpoint);
+
int actualLineNumber;
int actualColumnNumber;
String16 debuggerBreakpointId = m_debugger->setBreakpoint(
- breakpoint, &actualLineNumber, &actualColumnNumber);
+ translatedBreakpoint, &actualLineNumber, &actualColumnNumber);
if (debuggerBreakpointId.isEmpty()) return nullptr;
m_serverBreakpoints[debuggerBreakpointId] =
@@ -515,7 +520,7 @@ V8DebuggerAgentImpl::resolveBreakpoint(const String16& breakpointId,
m_breakpointIdToDebuggerBreakpointIds[breakpointId].push_back(
debuggerBreakpointId);
- return buildProtocolLocation(breakpoint.script_id, actualLineNumber,
+ return buildProtocolLocation(translatedBreakpoint.script_id, actualLineNumber,
actualColumnNumber);
}
@@ -529,9 +534,8 @@ Response V8DebuggerAgentImpl::searchInContent(
return Response::Error("No script for id: " + scriptId);
std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches =
- searchInTextByLinesImpl(m_session,
- toProtocolString(it->second->source(m_isolate)),
- query, optionalCaseSensitive.fromMaybe(false),
+ searchInTextByLinesImpl(m_session, it->second->source(m_isolate), query,
+ optionalCaseSensitive.fromMaybe(false),
optionalIsRegex.fromMaybe(false));
*results = protocol::Array<protocol::Debugger::SearchMatch>::create();
for (size_t i = 0; i < matches.size(); ++i)
@@ -602,7 +606,7 @@ Response V8DebuggerAgentImpl::getScriptSource(const String16& scriptId,
if (it == m_scripts.end())
return Response::Error("No script for id: " + scriptId);
v8::HandleScope handles(m_isolate);
- *scriptSource = toProtocolString(it->second->source(m_isolate));
+ *scriptSource = it->second->source(m_isolate);
return Response::OK();
}
@@ -861,6 +865,10 @@ void V8DebuggerAgentImpl::didExecuteScript() {
changeJavaScriptRecursionLevel(-1);
}
+void V8DebuggerAgentImpl::newWasmScript(v8::Local<v8::Object> scriptWrapper) {
+ m_wasmTranslation.AddScript(scriptWrapper);
+}
+
void V8DebuggerAgentImpl::changeJavaScriptRecursionLevel(int step) {
if (m_javaScriptPauseScheduled && !m_skipAllPauses &&
!m_debugger->isPaused()) {
@@ -1004,6 +1012,8 @@ Response V8DebuggerAgentImpl::currentCallFrames(
protocol::ErrorSupport errorSupport;
*result = Array<CallFrame>::parse(protocolValue.get(), &errorSupport);
if (!*result) return Response::Error(errorSupport.errors());
+ for (size_t i = 0, e = (*result)->length(); i != e; ++i)
+ m_wasmTranslation.Translate((*result)->get(i)->getLocation());
return Response::OK();
}
@@ -1017,7 +1027,7 @@ std::unique_ptr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() {
void V8DebuggerAgentImpl::didParseSource(
std::unique_ptr<V8DebuggerScript> script, bool success) {
v8::HandleScope handles(m_isolate);
- String16 scriptSource = toProtocolString(script->source(m_isolate));
+ String16 scriptSource = script->source(m_isolate);
if (!success) script->setSourceURL(findSourceURL(scriptSource, false));
if (!success)
script->setSourceMappingURL(findSourceMapURL(scriptSource, false));
@@ -1046,14 +1056,14 @@ void V8DebuggerAgentImpl::didParseSource(
m_frontend.scriptParsed(
scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(),
scriptRef->endLine(), scriptRef->endColumn(),
- scriptRef->executionContextId(), scriptRef->hash(),
+ scriptRef->executionContextId(), scriptRef->hash(m_isolate),
std::move(executionContextAuxDataParam), isLiveEditParam,
std::move(sourceMapURLParam), hasSourceURLParam);
else
m_frontend.scriptFailedToParse(
scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(),
scriptRef->endLine(), scriptRef->endColumn(),
- scriptRef->executionContextId(), scriptRef->hash(),
+ scriptRef->executionContextId(), scriptRef->hash(m_isolate),
std::move(executionContextAuxDataParam), std::move(sourceMapURLParam),
hasSourceURLParam);
@@ -1241,4 +1251,9 @@ void V8DebuggerAgentImpl::reset() {
m_breakpointIdToDebuggerBreakpointIds.clear();
}
+void V8DebuggerAgentImpl::translateLocation(String16* scriptId, int* lineNumber,
+ int* columnNumber) {
+ m_wasmTranslation.Translate(scriptId, lineNumber, columnNumber);
+}
+
} // namespace v8_inspector

Powered by Google App Engine
This is Rietveld 408576698