diff --git a/src/mono/wasm/runtime/debug.ts b/src/mono/wasm/runtime/debug.ts index 0bc38cf21ad9ae..c1f7664adee76b 100644 --- a/src/mono/wasm/runtime/debug.ts +++ b/src/mono/wasm/runtime/debug.ts @@ -9,6 +9,8 @@ import { VoidPtr, CharPtr } from "./types/emscripten"; import { mono_log_warn } from "./logging"; import { localHeapViewU8 } from "./memory"; import { utf8ToString } from "./strings"; +import MonoWasmThreads from "consts:monoWasmThreads"; + const commands_received: any = new Map(); commands_received.remove = function (key: number): CommandResponse { const value = this.get(key); this.delete(key); return value; }; let _call_function_res_cache: any = {}; @@ -149,6 +151,11 @@ export function mono_wasm_debugger_attached(): void { if (runtimeHelpers.waitForDebugger == -1) runtimeHelpers.waitForDebugger = 1; cwraps.mono_wasm_set_is_debugger_attached(true); + if (MonoWasmThreads) { + const wasmMemory = Module.getMemory(); + wasmMemory.grow(wasmMemory.buffer.byteLength >>> 16); + runtimeHelpers.updateMemoryViews(); + } } export function mono_wasm_set_entrypoint_breakpoint(assembly_name: CharPtr, entrypoint_method_token: number): void {