Fix Wasm debugging based on the DWARF SourceMap approach

After the DebugSymbols CDP change landed, the backend stopped reporting
the fake wasm://dwarf source map urls. Until we properly support
DebugSymbols in the frontend, bring the fak url back in the frontend to
fix the DWARF SourceMap approach.

Bug: chromium:1082720
Change-Id: I366993c7183b9d47b7f42f7d2517571907f913f3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2201636
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
This commit is contained in:
Philip Pfaffe
2020-05-14 14:49:25 +00:00
committed by Commit Bot
parent 74e1a7aa26
commit f5e2e5abac
2 changed files with 15 additions and 6 deletions
+7 -5
View File
@@ -642,12 +642,13 @@ export class DebuggerModel extends SDKModel {
* @param {?Protocol.Runtime.StackTrace} originStackTrace
* @param {?number} codeOffset
* @param {?string} scriptLanguage
* @param {?Protocol.Debugger.DebugSymbols} debugSymbols
* @return {!Script}
*/
_parsedScriptSource(
scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash,
executionContextAuxData, isLiveEdit, sourceMapURL, hasSourceURLComment, hasSyntaxError, length, originStackTrace,
codeOffset, scriptLanguage) {
codeOffset, scriptLanguage, debugSymbols) {
if (this._scripts.has(scriptId)) {
return this._scripts.get(scriptId);
}
@@ -659,7 +660,7 @@ export class DebuggerModel extends SDKModel {
const script = new Script(
this, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId,
this._internString(hash), isContentScript, isLiveEdit, sourceMapURL, hasSourceURLComment, length,
originStackTrace, codeOffset, scriptLanguage);
originStackTrace, codeOffset, scriptLanguage, debugSymbols);
this._registerScript(script);
this.dispatchEventToListeners(Events.ParsedScriptSource, script);
@@ -1108,15 +1109,16 @@ class DebuggerDispatcher {
* @param {!Protocol.Runtime.StackTrace=} stackTrace
* @param {number=} codeOffset
* @param {string=} scriptLanguage
* @param {!Protocol.Debugger.DebugSymbols=} debugSymbols
*/
scriptParsed(
scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash,
executionContextAuxData, isLiveEdit, sourceMapURL, hasSourceURL, isModule, length, stackTrace, codeOffset,
scriptLanguage) {
scriptLanguage, debugSymbols) {
this._debuggerModel._parsedScriptSource(
scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash,
executionContextAuxData, !!isLiveEdit, sourceMapURL, !!hasSourceURL, false, length || 0, stackTrace || null,
codeOffset || null, scriptLanguage || null);
codeOffset || null, scriptLanguage || null, debugSymbols || null);
}
/**
@@ -1144,7 +1146,7 @@ class DebuggerDispatcher {
this._debuggerModel._parsedScriptSource(
scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash,
executionContextAuxData, false, sourceMapURL, !!hasSourceURL, true, length || 0, stackTrace || null,
codeOffset || null, scriptLanguage || null);
codeOffset || null, scriptLanguage || null, null);
}
/**
+8 -1
View File
@@ -54,10 +54,12 @@ export class Script {
* @param {?Protocol.Runtime.StackTrace} originStackTrace
* @param {?number} codeOffset
* @param {?string} scriptLanguage
* @param {?Protocol.Debugger.DebugSymbols} debugSymbols
*/
constructor(
debuggerModel, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash,
isContentScript, isLiveEdit, sourceMapURL, hasSourceURL, length, originStackTrace, codeOffset, scriptLanguage) {
isContentScript, isLiveEdit, sourceMapURL, hasSourceURL, length, originStackTrace, codeOffset, scriptLanguage,
debugSymbols) {
/** @type {?string} */
this._source;
@@ -74,6 +76,11 @@ export class Script {
this._isContentScript = isContentScript;
this._isLiveEdit = isLiveEdit;
this.sourceMapURL = sourceMapURL;
if (!sourceMapURL && debugSymbols && debugSymbols.type === 'EmbeddedDWARF') {
// TODO(chromium:1064248) Remove this once we either drop gimli or support DebugSymbols all the way down.
this.sourceMapURL = 'wasm://dwarf';
}
this.debugSymbols = debugSymbols;
this.hasSourceURL = hasSourceURL;
this.contentLength = length;
this._originalContentProvider = null;