| 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 60d58390e3fa1aa9d2d9f05e03aefc383dcb7a7e..55e59e282f5a04314ae557233d749b905a817a36 100644
|
| --- a/src/inspector/v8-debugger-agent-impl.cc
|
| +++ b/src/inspector/v8-debugger-agent-impl.cc
|
| @@ -115,7 +115,8 @@ V8DebuggerAgentImpl::V8DebuggerAgentImpl(
|
| m_skippedStepFrameCount(0),
|
| m_recursionLevelForStepOut(0),
|
| m_recursionLevelForStepFrame(0),
|
| - m_skipAllPauses(false) {
|
| + m_skipAllPauses(false),
|
| + m_wasmTranslation(m_isolate, this) {
|
| clearBreakDetails();
|
| }
|
|
|
| @@ -182,6 +183,7 @@ Response V8DebuggerAgentImpl::disable() {
|
| m_state->remove(DebuggerAgentState::blackboxPattern);
|
| m_enabled = false;
|
| m_state->setBoolean(DebuggerAgentState::debuggerEnabled, false);
|
| + m_wasmTranslation.Clear();
|
| return Response::OK();
|
| }
|
|
|
| @@ -497,10 +499,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] =
|
| @@ -509,7 +514,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);
|
| }
|
|
|
| @@ -523,9 +528,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)
|
| @@ -596,7 +600,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();
|
| }
|
|
|
| @@ -855,6 +859,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()) {
|
| @@ -998,6 +1006,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();
|
| }
|
|
|
| @@ -1011,7 +1021,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));
|
| @@ -1034,13 +1044,13 @@ void V8DebuggerAgentImpl::didParseSource(
|
| m_frontend.scriptParsed(
|
| scriptId, scriptURL, script->startLine(), script->startColumn(),
|
| script->endLine(), script->endColumn(), script->executionContextId(),
|
| - script->hash(), std::move(executionContextAuxDataParam),
|
| + script->hash(m_isolate), std::move(executionContextAuxDataParam),
|
| isLiveEditParam, std::move(sourceMapURLParam), hasSourceURLParam);
|
| else
|
| m_frontend.scriptFailedToParse(
|
| scriptId, scriptURL, script->startLine(), script->startColumn(),
|
| script->endLine(), script->endColumn(), script->executionContextId(),
|
| - script->hash(), std::move(executionContextAuxDataParam),
|
| + script->hash(m_isolate), std::move(executionContextAuxDataParam),
|
| std::move(sourceMapURLParam), hasSourceURLParam);
|
|
|
| m_scripts[scriptId] = std::move(script);
|
| @@ -1229,4 +1239,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
|
|
|