Bug 1719615 - [devtools] Enable 'observeWasm' only once the debugger is opened. r=yury,bomsy

Because WASM debugging triggers different machine code with debugging instruction,
the memory usage very significantly increase.
So avoid enabling it until the debugger is opened.

Differential Revision: https://phabricator.services.mozilla.com/D140069
This commit is contained in:
Alexandre Poirot 2022-03-24 21:03:41 +00:00
Родитель b8128f1562
Коммит 8072e8c62b
3 изменённых файлов: 21 добавлений и 8 удалений

Просмотреть файл

@ -43,13 +43,21 @@ export async function onConnect(_commands, _resourceCommand, _actions, store) {
}
await targetCommand.startListening();
}
// `pauseWorkersUntilAttach` is one option set when the debugger panel is opened rather that from the toolbox.
// The reason is to support early breakpoints in workers, which will force the workers to pause
// and later on (when TargetMixin.attachThread is called) resume worker execution, after passing the breakpoints.
// We only observe workers when the debugger panel is opened (see the few lines before and listenForWorkers = true).
// So if we were passing `pauseWorkersUntilAttach=true` from the toolbox code, workers would freeze as we would not watch
// for their targets and not resume them.
const options = { pauseWorkersUntilAttach: true };
const options = {
// `pauseWorkersUntilAttach` is one option set when the debugger panel is opened rather that from the toolbox.
// The reason is to support early breakpoints in workers, which will force the workers to pause
// and later on (when TargetMixin.attachThread is called) resume worker execution, after passing the breakpoints.
// We only observe workers when the debugger panel is opened (see the few lines before and listenForWorkers = true).
// So if we were passing `pauseWorkersUntilAttach=true` from the toolbox code, workers would freeze as we would not watch
// for their targets and not resume them.
pauseWorkersUntilAttach: true,
// Bug 1719615 - Immediately turn on WASM debugging when the debugger opens.
// We avoid enabling that as soon as DevTools open as WASM generates different kind of machine code
// with debugging instruction which significantly increase the memory usage.
observeWasm: true,
};
await commands.threadConfigurationCommand.updateConfiguration(options);
// We should probably only pass descriptor informations from here

Просмотреть файл

@ -43,7 +43,6 @@ exports.getThreadOptions = async function() {
),
// This option is always true. See Bug 1654590 for removal.
observeAsmJS: true,
observeWasm: true,
breakpoints: sanitizeBreakpoints(await asyncStore.pendingBreakpoints),
// XXX: `event-listener-breakpoints` is a copy of the event-listeners state
// of the debugger panel. The `active` property is therefore linked to

Просмотреть файл

@ -61,8 +61,14 @@ module.exports = function makeDebugger({
const dbg = new Debugger();
EventEmitter.decorate(dbg);
// By default, we disable asm.js and WASM debugging because of performance reason.
// Enabling asm.js debugging (allowUnobservedAsmJS=false) will make asm.js fallback to JS compiler
// and be debugging as a regular JS script.
dbg.allowUnobservedAsmJS = true;
// Enabling WASM debugging (allowUnobservedWasm=false) will make the engine compile WASM scripts
// into different machine code with debugging instructions. This significantly increase the memory usage of it.
dbg.allowUnobservedWasm = true;
dbg.uncaughtExceptionHook = reportDebuggerHookException;
const onNewGlobalObject = function(global) {