wasm-idle 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -91
- package/dist/container/bash-profile.d.ts +80 -0
- package/dist/container/bash-profile.js +328 -0
- package/dist/{playground/container → container}/binding.d.ts +21 -8
- package/dist/{playground/container → container}/binding.js +109 -25
- package/dist/{playground/container → container}/clang-runtime.d.ts +11 -7
- package/dist/container/clang-runtime.js +561 -0
- package/dist/container/client.d.ts +14 -0
- package/dist/{playground/container → container}/client.js +2 -6
- package/dist/{playground/container → container}/explorer.d.ts +1 -1
- package/dist/container/index.d.ts +11 -0
- package/dist/container/index.js +11 -0
- package/dist/container/owner-worker.d.ts +19 -0
- package/dist/container/owner-worker.js +464 -0
- package/dist/{playground/container → container}/protocol.d.ts +12 -1
- package/dist/{playground/container → container}/runtime-adapter.d.ts +13 -11
- package/dist/{playground/container → container}/runtime-adapter.js +104 -41
- package/dist/{playground/container → container}/shell-control.d.ts +2 -2
- package/dist/{playground/container → container}/shell-control.js +93 -36
- package/dist/{playground/container → container}/workspace.d.ts +5 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/playground/assetBridge.js +5 -2
- package/dist/playground/assets.d.ts +8 -0
- package/dist/playground/clang.d.ts +5 -1
- package/dist/playground/clang.js +61 -5
- package/dist/playground/compiledLldb.d.ts +41 -0
- package/dist/playground/compiledLldb.js +167 -0
- package/dist/playground/d.d.ts +4 -1
- package/dist/playground/d.js +78 -9
- package/dist/playground/debugDeadline.d.ts +12 -0
- package/dist/playground/debugDeadline.js +34 -0
- package/dist/playground/debugMailbox.d.ts +12 -0
- package/dist/playground/debugMailbox.js +77 -0
- package/dist/playground/go.js +9 -4
- package/dist/playground/goDebugInstrumentation.js +24 -44
- package/dist/playground/java-debug-HUZVAK4F.js +124 -0
- package/dist/playground/java-debug-notices.txt +492 -0
- package/dist/playground/java.d.ts +17 -1
- package/dist/playground/java.js +159 -3
- package/dist/playground/javaDebug.d.ts +62 -0
- package/dist/playground/javaDebug.js +305 -0
- package/dist/playground/javaDebugBridge.d.ts +6 -0
- package/dist/playground/javaDebugBridge.js +250 -0
- package/dist/playground/javaDebugSource.d.ts +9 -0
- package/dist/playground/javaDebugSource.js +4 -0
- package/dist/playground/javaRuntimeErrors.js +34 -1
- package/dist/playground/lean4Assets.d.ts +1 -25
- package/dist/playground/lean4Assets.js +2 -123
- package/dist/playground/lfortranAssets.d.ts +2 -2
- package/dist/playground/lldbSession.d.ts +24 -2
- package/dist/playground/lldbSession.js +322 -59
- package/dist/playground/lldbSourcePath.d.ts +2 -0
- package/dist/playground/lldbSourcePath.js +9 -0
- package/dist/playground/lua.d.ts +20 -1
- package/dist/playground/lua.js +190 -8
- package/dist/playground/luaDebug.d.ts +1 -0
- package/dist/playground/luaDebug.js +1 -0
- package/dist/playground/nim.d.ts +1 -0
- package/dist/playground/nim.js +8 -0
- package/dist/playground/objectivec.d.ts +7 -6
- package/dist/playground/objectivec.js +75 -9
- package/dist/playground/options.d.ts +10 -4
- package/dist/playground/python.d.ts +11 -1
- package/dist/playground/python.js +203 -8
- package/dist/playground/pythonCompileOptions.d.ts +49 -0
- package/dist/playground/pythonCompileOptions.js +40 -0
- package/dist/playground/ruby.d.ts +10 -1
- package/dist/playground/ruby.js +66 -1
- package/dist/playground/rubyDebug.d.ts +21 -0
- package/dist/playground/rubyDebug.js +128 -0
- package/dist/playground/rust.d.ts +5 -1
- package/dist/playground/rust.js +128 -46
- package/dist/playground/sandbox.d.ts +8 -1
- package/dist/playground/staticRuntimeModuleVersion.d.ts +1 -1
- package/dist/playground/staticRuntimeModuleVersion.js +1 -1
- package/dist/playground/staticWorkerRuntime.js +8 -2
- package/dist/playground/stdinBuffer.d.ts +1 -1
- package/dist/playground/stdinBuffer.js +19 -2
- package/dist/playground/tinygo.js +7 -0
- package/dist/playground/typescript.js +8 -0
- package/dist/playground/v.d.ts +3 -2
- package/dist/playground/v.js +66 -12
- package/dist/playground/wasmC3Version.d.ts +2 -2
- package/dist/playground/wasmC3Version.js +2 -2
- package/dist/playground/wasmDebugVersion.d.ts +1 -1
- package/dist/playground/wasmDebugVersion.js +1 -1
- package/dist/playground/wasmLean4Version.d.ts +1 -110
- package/dist/playground/wasmLean4Version.js +2 -111
- package/dist/playground/wasmLfortranVersion.d.ts +2 -2
- package/dist/playground/wasmLfortranVersion.js +2 -2
- package/dist/playground/wasmLuaVersion.d.ts +1 -1
- package/dist/playground/wasmLuaVersion.js +1 -1
- package/dist/playground/wasmPrologVersion.d.ts +17 -17
- package/dist/playground/wasmPrologVersion.js +16 -16
- package/dist/playground/wasmRustVersion.d.ts +26 -38
- package/dist/playground/wasmRustVersion.js +25 -40
- package/dist/playground/wasmTypeScriptVersion.d.ts +3 -3
- package/dist/playground/wasmTypeScriptVersion.js +3 -3
- package/dist/playground/worker/clang.js +1 -1
- package/dist/playground/worker/cobol.js +1 -1
- package/dist/playground/worker/d.js +51 -2
- package/dist/playground/worker/fortran.js +1 -1
- package/dist/playground/worker/java.js +188 -35
- package/dist/playground/worker/javaDebugEvaluator.d.ts +16 -0
- package/dist/playground/worker/javaDebugEvaluator.js +44 -0
- package/dist/playground/worker/javaDebugRuntime.d.ts +24 -0
- package/dist/playground/worker/javaDebugRuntime.js +315 -0
- package/dist/playground/worker/javaOutput.d.ts +11 -0
- package/dist/playground/worker/javaOutput.js +54 -0
- package/dist/playground/worker/lua.js +13 -0
- package/dist/playground/worker/python.js +81 -23
- package/dist/playground/worker/pythonCompile.d.ts +4 -0
- package/dist/playground/worker/pythonCompile.js +122 -0
- package/dist/playground/worker/ruby.js +13 -0
- package/dist/playground/worker/rubyDebugPreview.d.ts +2 -0
- package/dist/playground/worker/rubyDebugPreview.js +80 -0
- package/dist/playground/worker/rubyTracepoint.d.ts +16 -0
- package/dist/playground/worker/rubyTracepoint.js +162 -0
- package/dist/playground/worker/rust.js +4 -1
- package/dist/playground/worker/v.js +30 -5
- package/dist/playground/zig.js +4 -0
- package/dist/pythonCompiler.d.ts +8 -0
- package/dist/pythonCompiler.js +52 -0
- package/package.json +76 -28
- package/dist/playground/container/ContainerExplorer.svelte +0 -307
- package/dist/playground/container/ContainerExplorer.svelte.d.ts +0 -14
- package/dist/playground/container/clang-runtime.js +0 -343
- package/dist/playground/container/client.d.ts +0 -15
- package/dist/playground/container/owner.worker.d.ts +0 -1
- package/dist/playground/container/owner.worker.js +0 -390
- package/dist/playground/container/release.d.ts +0 -31
- package/dist/playground/container/release.js +0 -612
- /package/dist/{playground/container → container}/explorer.js +0 -0
- /package/dist/{playground/container → container}/protocol.js +0 -0
- /package/dist/{playground/container → container}/workspace.js +0 -0
package/dist/playground/clang.js
CHANGED
|
@@ -4,7 +4,7 @@ import { RuntimeAssetCache } from './runtimeAssetCache';
|
|
|
4
4
|
import { resolveDebugRuntimeUrls, resolveRuntimeAssetConfig } from './assets';
|
|
5
5
|
import { LldbSandboxSession } from './lldbSession';
|
|
6
6
|
import { normalizeDwarfWorkspacePath } from '@wasm-idle/llvm-core/clang';
|
|
7
|
-
import { resolveExecutionLimits } from '@wasm-idle/core';
|
|
7
|
+
import { resolveExecutionLimits, normalizeDebugSourceBreakpoints, mergeDebugBreakpointLines, assertDebugBreakpointSupport } from '@wasm-idle/core';
|
|
8
8
|
import { resolveSandboxExecutionArgs } from './options';
|
|
9
9
|
import { bufferedSequence, flushBufferedEof, flushQueuedStdin, resetBufferedStdin, waitForBufferedSequenceChange } from './stdinBuffer';
|
|
10
10
|
import { createWasmIdleSharedBuffer, requireSharedArrayBuffer } from './sharedBuffer';
|
|
@@ -47,6 +47,7 @@ class Clang {
|
|
|
47
47
|
disposal;
|
|
48
48
|
debugMode = 'none';
|
|
49
49
|
lldbBreakpoints = new Map();
|
|
50
|
+
lldbBreakpointSpecifications = new Map();
|
|
50
51
|
debugEvaluationQueue = Promise.resolve();
|
|
51
52
|
// A helper worker builds the precompiled <bits/stdc++.h> so the warm worker stays free for
|
|
52
53
|
// runs. The header is sent once to each warm worker, which keeps it for later compiles.
|
|
@@ -198,6 +199,9 @@ class Clang {
|
|
|
198
199
|
if (this.disposed)
|
|
199
200
|
return Promise.reject(new Error('Clang runtime has been disposed'));
|
|
200
201
|
const debugMode = options.debugMode || (options.debug ? 'trace' : 'none');
|
|
202
|
+
if (debugMode !== 'none' && debugMode !== 'trace' && debugMode !== 'lldb') {
|
|
203
|
+
return Promise.reject(new Error(`${this.language} does not support ${debugMode} debugging.`));
|
|
204
|
+
}
|
|
201
205
|
this.debugMode = debugMode;
|
|
202
206
|
if (debugMode !== 'none')
|
|
203
207
|
requireSharedArrayBuffer(`${this.language} debugging`);
|
|
@@ -213,14 +217,33 @@ class Clang {
|
|
|
213
217
|
const { compileArgs, programArgs } = resolveSandboxExecutionArgs(this.language, args, options);
|
|
214
218
|
const sourcePath = normalizeLldbSourcePath(options.debugPath || options.activePath, this.language === 'C' ? 'main.c' : 'main.cc');
|
|
215
219
|
this.lldbBreakpoints.clear();
|
|
220
|
+
this.lldbBreakpointSpecifications.clear();
|
|
216
221
|
if (debugMode === 'lldb') {
|
|
217
222
|
for (const sourceBreakpoints of options.sourceBreakpoints || []) {
|
|
218
|
-
|
|
223
|
+
if (sourceBreakpoints.breakpoints) {
|
|
224
|
+
const values = normalizeDebugSourceBreakpoints(sourceBreakpoints.breakpoints);
|
|
225
|
+
const path = normalizeLldbSourcePath(sourceBreakpoints.sourcePath, sourcePath.replace(/^\/workspace\//u, ''));
|
|
226
|
+
this.lldbBreakpointSpecifications.set(path, values);
|
|
227
|
+
this.lldbBreakpoints.set(path, values
|
|
228
|
+
.filter((value) => value.enabled !== false)
|
|
229
|
+
.map((value) => value.line));
|
|
230
|
+
}
|
|
231
|
+
else
|
|
232
|
+
this.setBreakpoints(sourceBreakpoints.lines, sourceBreakpoints.sourcePath);
|
|
219
233
|
}
|
|
220
|
-
this.
|
|
234
|
+
if (!this.lldbBreakpointSpecifications.has(sourcePath))
|
|
235
|
+
this.setBreakpoints([...(options.breakpoints || [])], sourcePath);
|
|
221
236
|
}
|
|
222
237
|
else {
|
|
223
|
-
|
|
238
|
+
for (const source of options.sourceBreakpoints || [])
|
|
239
|
+
if (source.breakpoints)
|
|
240
|
+
assertDebugBreakpointSupport(normalizeDebugSourceBreakpoints(source.breakpoints), {});
|
|
241
|
+
const source = options.sourceBreakpoints?.find((entry) => normalizeLldbSourcePath(entry.sourcePath, sourcePath.replace(/^\/workspace\//u, '')) === sourcePath);
|
|
242
|
+
this.setBreakpoints(source?.breakpoints
|
|
243
|
+
? source.breakpoints
|
|
244
|
+
.filter((value) => value.enabled !== false)
|
|
245
|
+
.map((value) => value.line)
|
|
246
|
+
: [...(options.breakpoints || [])], sourcePath);
|
|
224
247
|
}
|
|
225
248
|
const interrupt = new Uint8Array(this.interruptBuffer), _uid = ++this.uid;
|
|
226
249
|
const handler = (event) => {
|
|
@@ -256,9 +279,15 @@ class Clang {
|
|
|
256
279
|
breakpoints: [...(options.breakpoints || [])],
|
|
257
280
|
sourceBreakpoints: Array.from(this.lldbBreakpoints, ([sourcePath, lines]) => ({
|
|
258
281
|
sourcePath,
|
|
259
|
-
lines: [...lines]
|
|
282
|
+
lines: [...lines],
|
|
283
|
+
...(this.lldbBreakpointSpecifications.has(sourcePath)
|
|
284
|
+
? {
|
|
285
|
+
breakpoints: normalizeDebugSourceBreakpoints(this.lldbBreakpointSpecifications.get(sourcePath))
|
|
286
|
+
}
|
|
287
|
+
: {})
|
|
260
288
|
})),
|
|
261
289
|
pauseOnEntry: !!options.pauseOnEntry,
|
|
290
|
+
debugSteppingOptions: options.debugSteppingOptions,
|
|
262
291
|
pauseAtMain: true,
|
|
263
292
|
programArgs,
|
|
264
293
|
stdin: options.stdin,
|
|
@@ -386,6 +415,8 @@ class Clang {
|
|
|
386
415
|
return this.lldbSession.setBreakpoints(lines, resolvedSourcePath);
|
|
387
416
|
}
|
|
388
417
|
if (this.debugMode === 'lldb') {
|
|
418
|
+
if (this.lldbBreakpointSpecifications.has(resolvedSourcePath))
|
|
419
|
+
return this.setSourceBreakpoints(mergeDebugBreakpointLines(this.lldbBreakpointSpecifications.get(resolvedSourcePath), lines), resolvedSourcePath);
|
|
389
420
|
this.lldbBreakpoints.set(resolvedSourcePath, [...lines]);
|
|
390
421
|
return;
|
|
391
422
|
}
|
|
@@ -399,6 +430,31 @@ class Clang {
|
|
|
399
430
|
Atomics.store(control, 3, next.length);
|
|
400
431
|
Atomics.add(control, 2, 1);
|
|
401
432
|
}
|
|
433
|
+
async setSourceBreakpoints(breakpoints, sourcePath) {
|
|
434
|
+
const values = normalizeDebugSourceBreakpoints(breakpoints);
|
|
435
|
+
const path = normalizeLldbSourcePath(sourcePath, this.language === 'C' ? 'main.c' : 'main.cc');
|
|
436
|
+
if (this.lldbSession)
|
|
437
|
+
return this.lldbSession.setSourceBreakpoints(values, path);
|
|
438
|
+
if (this.debugMode === 'lldb') {
|
|
439
|
+
this.lldbBreakpointSpecifications.set(path, values);
|
|
440
|
+
this.lldbBreakpoints.set(path, values.filter((value) => value.enabled !== false).map((value) => value.line));
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
assertDebugBreakpointSupport(values, {});
|
|
444
|
+
this.setBreakpoints(values.filter((value) => value.enabled !== false).map((value) => value.line), sourcePath);
|
|
445
|
+
}
|
|
446
|
+
async debugSetSteppingOptions(options) {
|
|
447
|
+
if (!this.lldbSession)
|
|
448
|
+
throw new Error('Stepping options require an LLDB session.');
|
|
449
|
+
await this.lldbSession.setSteppingOptions(options);
|
|
450
|
+
}
|
|
451
|
+
async debugEvaluateValue(expression, options) {
|
|
452
|
+
if (this.lldbSession)
|
|
453
|
+
return this.lldbSession.evaluateValue(expression, options);
|
|
454
|
+
if (options?.frameId !== undefined || options?.context === 'hover')
|
|
455
|
+
return { result: '?', variablesReference: 0 };
|
|
456
|
+
return { result: await this.debugEvaluate(expression), variablesReference: 0 };
|
|
457
|
+
}
|
|
402
458
|
debugEvaluate(expression) {
|
|
403
459
|
if (this.lldbSession)
|
|
404
460
|
return this.lldbSession.evaluate(expression);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type PlaygroundRuntimeAssets } from './assets';
|
|
2
|
+
import { LldbSandboxSession, type LldbArtifactPayload } from './lldbSession';
|
|
3
|
+
import type { DebugCommand, DebugDataBreakpoint, DebugDataBreakpointInfoArguments, DebugSessionEvent, SandboxExecutionOptions } from './options';
|
|
4
|
+
import { type DebugEvaluateOptions, type DebugSourceBreakpoint, type DebugSteppingOptions } from '@wasm-idle/core';
|
|
5
|
+
/** The common LLDB controls for compilers that hand a real DWARF module to WAMR. */
|
|
6
|
+
export declare class CompiledLldbSandbox {
|
|
7
|
+
output?: (data: string) => void;
|
|
8
|
+
ondebug?: (event: DebugSessionEvent) => void;
|
|
9
|
+
protected lldbSession?: LldbSandboxSession;
|
|
10
|
+
protected lldbPending: boolean;
|
|
11
|
+
protected lldbEntryFunction: string;
|
|
12
|
+
private lldbRuntime?;
|
|
13
|
+
private lldbSourcePath;
|
|
14
|
+
private readonly lldbBreakpoints;
|
|
15
|
+
private readonly lldbBreakpointSpecifications;
|
|
16
|
+
private lldbPersistentCache?;
|
|
17
|
+
protected configureLldb(runtimeAssets: string | PlaygroundRuntimeAssets, options: SandboxExecutionOptions): void;
|
|
18
|
+
protected prepareLldb(options: SandboxExecutionOptions, defaultPath: string): void;
|
|
19
|
+
protected lldbReloadAssets(): Pick<PlaygroundRuntimeAssets, 'debug' | 'persistentCache'>;
|
|
20
|
+
protected startLldb(artifact: LldbArtifactPayload, options: SandboxExecutionOptions, programArgs: string[], pendingInput: string[], pendingEof: boolean, onOutput?: (text: string) => void | undefined): Promise<true>;
|
|
21
|
+
protected stopLldb(): Promise<void> | undefined;
|
|
22
|
+
private sourcePath;
|
|
23
|
+
debugCommand(command: DebugCommand): Promise<void> | undefined;
|
|
24
|
+
debugPause(): Promise<void> | undefined;
|
|
25
|
+
setBreakpoints(lines: number[], sourcePath?: string): Promise<void> | undefined;
|
|
26
|
+
setSourceBreakpoints(breakpoints: DebugSourceBreakpoint[], sourcePath?: string): Promise<void>;
|
|
27
|
+
debugSetSteppingOptions(options: DebugSteppingOptions): Promise<void>;
|
|
28
|
+
debugEvaluateValue(expression: string, options?: DebugEvaluateOptions): Promise<import("@wasm-idle/core").DebugEvaluateResult>;
|
|
29
|
+
debugEvaluate(expression: string): Promise<string>;
|
|
30
|
+
debugVariables(reference: number, start?: number, count?: number): Promise<import("@wasm-idle/core").DebugVariable[]>;
|
|
31
|
+
debugScopes(frameId: number): Promise<import("@wasm-idle/core").DebugScope[]>;
|
|
32
|
+
debugFrameScopes(frameId: number): Promise<import("@wasm-idle/core").DebugScope[]>;
|
|
33
|
+
debugFrameName(frameId: number): Promise<string | null>;
|
|
34
|
+
debugReadMemory(reference: string, offset: number, count: number): Promise<import("@wasm-idle/core").DebugMemory | null>;
|
|
35
|
+
debugWriteMemory(reference: string, offset: number, data: Uint8Array, allowPartial?: boolean): Promise<{
|
|
36
|
+
offset?: number;
|
|
37
|
+
bytesWritten: number;
|
|
38
|
+
} | null>;
|
|
39
|
+
debugDataBreakpointInfo(arguments_: DebugDataBreakpointInfoArguments): Promise<import("@wasm-idle/core").DebugDataBreakpointInfo | null>;
|
|
40
|
+
debugSetDataBreakpoints(breakpoints: DebugDataBreakpoint[]): Promise<import("@wasm-idle/core").DebugResolvedDataBreakpoint[]>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { resolveDebugRuntimeUrls } from './assets';
|
|
2
|
+
import { LldbSandboxSession } from './lldbSession';
|
|
3
|
+
import { normalizeLldbWorkspacePath } from './lldbSourcePath';
|
|
4
|
+
import { mergeDebugBreakpointLines, normalizeDebugSourceBreakpoints } from '@wasm-idle/core';
|
|
5
|
+
/** The common LLDB controls for compilers that hand a real DWARF module to WAMR. */
|
|
6
|
+
export class CompiledLldbSandbox {
|
|
7
|
+
output;
|
|
8
|
+
ondebug;
|
|
9
|
+
lldbSession;
|
|
10
|
+
lldbPending = false;
|
|
11
|
+
lldbEntryFunction = 'main';
|
|
12
|
+
lldbRuntime;
|
|
13
|
+
lldbSourcePath = '/workspace/main';
|
|
14
|
+
lldbBreakpoints = new Map();
|
|
15
|
+
lldbBreakpointSpecifications = new Map();
|
|
16
|
+
lldbPersistentCache;
|
|
17
|
+
configureLldb(runtimeAssets, options) {
|
|
18
|
+
this.lldbRuntime = resolveDebugRuntimeUrls(runtimeAssets, typeof window !== 'undefined' ? window.location.href : '');
|
|
19
|
+
this.lldbPersistentCache =
|
|
20
|
+
options.persistentCache ??
|
|
21
|
+
(typeof runtimeAssets === 'object' ? runtimeAssets.persistentCache : undefined);
|
|
22
|
+
}
|
|
23
|
+
prepareLldb(options, defaultPath) {
|
|
24
|
+
this.lldbPending = true;
|
|
25
|
+
this.lldbSourcePath = this.sourcePath(options.debugPath || options.activePath || defaultPath);
|
|
26
|
+
this.lldbBreakpoints.clear();
|
|
27
|
+
this.lldbBreakpointSpecifications.clear();
|
|
28
|
+
for (const entry of options.sourceBreakpoints || []) {
|
|
29
|
+
const path = this.sourcePath(entry.sourcePath);
|
|
30
|
+
if (entry.breakpoints) {
|
|
31
|
+
const values = normalizeDebugSourceBreakpoints(entry.breakpoints);
|
|
32
|
+
this.lldbBreakpointSpecifications.set(path, values);
|
|
33
|
+
this.lldbBreakpoints.set(path, values.filter((value) => value.enabled !== false).map((value) => value.line));
|
|
34
|
+
}
|
|
35
|
+
else
|
|
36
|
+
this.lldbBreakpoints.set(path, [...entry.lines]);
|
|
37
|
+
}
|
|
38
|
+
if (!this.lldbBreakpoints.has(this.lldbSourcePath)) {
|
|
39
|
+
this.lldbBreakpoints.set(this.lldbSourcePath, [...(options.breakpoints || [])]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
lldbReloadAssets() {
|
|
43
|
+
return {
|
|
44
|
+
debug: this.lldbRuntime
|
|
45
|
+
? {
|
|
46
|
+
baseUrl: this.lldbRuntime.baseUrl,
|
|
47
|
+
manifestUrl: this.lldbRuntime.manifestUrl,
|
|
48
|
+
manifestSha256: this.lldbRuntime.manifestReceipt?.sha256
|
|
49
|
+
}
|
|
50
|
+
: undefined,
|
|
51
|
+
persistentCache: this.lldbPersistentCache
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
startLldb(artifact, options, programArgs, pendingInput, pendingEof, onOutput = (text) => this.output?.(text)) {
|
|
55
|
+
if (!this.lldbRuntime)
|
|
56
|
+
throw new Error('LLDB runtime assets have not been configured.');
|
|
57
|
+
const session = new LldbSandboxSession({
|
|
58
|
+
manifestUrl: this.lldbRuntime.manifestUrl,
|
|
59
|
+
manifestReceipt: this.lldbRuntime.manifestReceipt,
|
|
60
|
+
runtimeBaseUrl: this.lldbRuntime.baseUrl,
|
|
61
|
+
persistentCache: options.persistentCache ?? this.lldbPersistentCache,
|
|
62
|
+
artifact,
|
|
63
|
+
sourcePath: this.lldbSourcePath,
|
|
64
|
+
breakpoints: [...(this.lldbBreakpoints.get(this.lldbSourcePath) || [])],
|
|
65
|
+
sourceBreakpoints: [...this.lldbBreakpoints].map(([sourcePath, lines]) => ({
|
|
66
|
+
sourcePath,
|
|
67
|
+
lines: [...lines],
|
|
68
|
+
...(this.lldbBreakpointSpecifications.has(sourcePath)
|
|
69
|
+
? {
|
|
70
|
+
breakpoints: normalizeDebugSourceBreakpoints(this.lldbBreakpointSpecifications.get(sourcePath))
|
|
71
|
+
}
|
|
72
|
+
: {})
|
|
73
|
+
})),
|
|
74
|
+
debugSteppingOptions: options.debugSteppingOptions,
|
|
75
|
+
pauseOnEntry: !!options.pauseOnEntry,
|
|
76
|
+
pauseAtMain: true,
|
|
77
|
+
entryFunctionName: this.lldbEntryFunction,
|
|
78
|
+
programArgs,
|
|
79
|
+
stdin: options.stdin,
|
|
80
|
+
onDebugEvent: (event) => this.ondebug?.(event),
|
|
81
|
+
onOutput
|
|
82
|
+
});
|
|
83
|
+
this.lldbSession = session;
|
|
84
|
+
for (const input of pendingInput.splice(0))
|
|
85
|
+
void session.write(input);
|
|
86
|
+
if (pendingEof)
|
|
87
|
+
void session.eof();
|
|
88
|
+
return session.start().finally(() => {
|
|
89
|
+
if (this.lldbSession === session) {
|
|
90
|
+
this.lldbSession = undefined;
|
|
91
|
+
this.lldbPending = false;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
stopLldb() {
|
|
96
|
+
const session = this.lldbSession;
|
|
97
|
+
this.lldbSession = undefined;
|
|
98
|
+
this.lldbPending = false;
|
|
99
|
+
return session?.disconnect();
|
|
100
|
+
}
|
|
101
|
+
sourcePath(path) {
|
|
102
|
+
const normalized = normalizeLldbWorkspacePath(path);
|
|
103
|
+
if (!normalized)
|
|
104
|
+
throw new Error('LLDB requires a workspace source path.');
|
|
105
|
+
return `/workspace/${normalized}`;
|
|
106
|
+
}
|
|
107
|
+
debugCommand(command) {
|
|
108
|
+
return this.lldbSession?.debugCommand(command);
|
|
109
|
+
}
|
|
110
|
+
debugPause() {
|
|
111
|
+
return this.lldbSession?.pause();
|
|
112
|
+
}
|
|
113
|
+
setBreakpoints(lines, sourcePath) {
|
|
114
|
+
const path = sourcePath ? this.sourcePath(sourcePath) : this.lldbSourcePath;
|
|
115
|
+
if (this.lldbSession)
|
|
116
|
+
return this.lldbSession.setBreakpoints(lines, path);
|
|
117
|
+
if (this.lldbBreakpointSpecifications.has(path))
|
|
118
|
+
return this.setSourceBreakpoints(mergeDebugBreakpointLines(this.lldbBreakpointSpecifications.get(path), lines), path);
|
|
119
|
+
this.lldbBreakpoints.set(path, [...lines]);
|
|
120
|
+
}
|
|
121
|
+
async setSourceBreakpoints(breakpoints, sourcePath) {
|
|
122
|
+
const values = normalizeDebugSourceBreakpoints(breakpoints);
|
|
123
|
+
const path = sourcePath ? this.sourcePath(sourcePath) : this.lldbSourcePath;
|
|
124
|
+
if (this.lldbSession)
|
|
125
|
+
return this.lldbSession.setSourceBreakpoints(values, path);
|
|
126
|
+
this.lldbBreakpointSpecifications.set(path, values);
|
|
127
|
+
this.lldbBreakpoints.set(path, values.filter((value) => value.enabled !== false).map((value) => value.line));
|
|
128
|
+
}
|
|
129
|
+
async debugSetSteppingOptions(options) {
|
|
130
|
+
if (!this.lldbSession)
|
|
131
|
+
throw new Error('Stepping options require an LLDB session.');
|
|
132
|
+
await this.lldbSession.setSteppingOptions(options);
|
|
133
|
+
}
|
|
134
|
+
debugEvaluateValue(expression, options) {
|
|
135
|
+
return (this.lldbSession?.evaluateValue(expression, options) ??
|
|
136
|
+
Promise.reject(new Error('LLDB is not running.')));
|
|
137
|
+
}
|
|
138
|
+
debugEvaluate(expression) {
|
|
139
|
+
return (this.lldbSession?.evaluate(expression) ??
|
|
140
|
+
Promise.reject(new Error('LLDB is not running.')));
|
|
141
|
+
}
|
|
142
|
+
debugVariables(reference, start, count) {
|
|
143
|
+
return this.lldbSession?.variables(reference, start, count) ?? Promise.resolve([]);
|
|
144
|
+
}
|
|
145
|
+
debugScopes(frameId) {
|
|
146
|
+
return this.lldbSession?.scopes(frameId) ?? Promise.resolve([]);
|
|
147
|
+
}
|
|
148
|
+
debugFrameScopes(frameId) {
|
|
149
|
+
return this.lldbSession?.frameScopes(frameId) ?? Promise.resolve([]);
|
|
150
|
+
}
|
|
151
|
+
debugFrameName(frameId) {
|
|
152
|
+
return this.lldbSession?.formattedFrameName(frameId) ?? Promise.resolve(null);
|
|
153
|
+
}
|
|
154
|
+
debugReadMemory(reference, offset, count) {
|
|
155
|
+
return this.lldbSession?.readMemory(reference, offset, count) ?? Promise.resolve(null);
|
|
156
|
+
}
|
|
157
|
+
debugWriteMemory(reference, offset, data, allowPartial = false) {
|
|
158
|
+
return (this.lldbSession?.writeMemory(reference, offset, data, allowPartial) ??
|
|
159
|
+
Promise.resolve(null));
|
|
160
|
+
}
|
|
161
|
+
debugDataBreakpointInfo(arguments_) {
|
|
162
|
+
return this.lldbSession?.dataBreakpointInfo(arguments_) ?? Promise.resolve(null);
|
|
163
|
+
}
|
|
164
|
+
debugSetDataBreakpoints(breakpoints) {
|
|
165
|
+
return this.lldbSession?.setDataBreakpoints(breakpoints) ?? Promise.resolve([]);
|
|
166
|
+
}
|
|
167
|
+
}
|
package/dist/playground/d.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type PlaygroundRuntimeAssets, type ResolvedDRuntimeAssetConfig } from './assets';
|
|
2
|
+
import { CompiledLldbSandbox } from './compiledLldb';
|
|
2
3
|
import { RuntimeAssetCache } from '@wasm-idle/core';
|
|
3
4
|
import { type CompilerDiagnostic, type SandboxExecutionOptions } from './options';
|
|
4
5
|
import type { Sandbox, SandboxProgress } from './sandbox';
|
|
5
|
-
declare class D implements Sandbox {
|
|
6
|
+
declare class D extends CompiledLldbSandbox implements Sandbox {
|
|
7
|
+
protected lldbEntryFunction: string;
|
|
6
8
|
output: any;
|
|
7
9
|
worker?: Worker;
|
|
8
10
|
buffer: import("./sharedBuffer").WasmIdleSharedBuffer;
|
|
@@ -19,6 +21,7 @@ declare class D implements Sandbox {
|
|
|
19
21
|
waitingForInput: boolean;
|
|
20
22
|
pendingEof: boolean;
|
|
21
23
|
private activeOperation;
|
|
24
|
+
private lldbAssets;
|
|
22
25
|
private disposed;
|
|
23
26
|
private runtimeAssetCache;
|
|
24
27
|
private ownsRuntimeAssetCache;
|
package/dist/playground/d.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { resolveDRuntimeAssetConfig } from './assets';
|
|
2
|
+
import { CompiledLldbSandbox } from './compiledLldb';
|
|
2
3
|
import { BusyError, CancelledError, createRuntimeAssetsKey, createRuntimeWasmModuleService, DEFAULT_WORKSPACE_LIMITS, DiagnosticLimitError, OutputLimitError, RuntimeConfigurationError, RuntimeAssetCache, TimeoutError, resolveExecutionLimits, validateExecutionWorkspace } from '@wasm-idle/core';
|
|
3
4
|
import { resolveSandboxExecutionArgs } from './options';
|
|
4
5
|
import { flushBufferedEof, flushQueuedStdin, resetBufferedStdin } from './stdinBuffer';
|
|
5
|
-
import { createWasmIdleSharedBuffer } from './sharedBuffer';
|
|
6
|
+
import { createWasmIdleSharedBuffer, requireSharedArrayBuffer } from './sharedBuffer';
|
|
6
7
|
import { WorkerSession } from './workerSession';
|
|
7
8
|
import { reportWorkerInputReady, reportWorkerProgress } from './workerProgress';
|
|
8
9
|
import { WASM_D_COMPILER_PROFILE } from './wasmDVersion';
|
|
@@ -11,7 +12,8 @@ const OUTPUT_ENCODER = new TextEncoder();
|
|
|
11
12
|
const abortReason = (signal, phase) => signal.reason !== undefined
|
|
12
13
|
? signal.reason
|
|
13
14
|
: new DOMException(phase === 'startup' ? 'D runtime startup aborted' : 'D execution aborted', 'AbortError');
|
|
14
|
-
class D {
|
|
15
|
+
class D extends CompiledLldbSandbox {
|
|
16
|
+
lldbEntryFunction = '_Dmain';
|
|
15
17
|
output = null;
|
|
16
18
|
worker = null;
|
|
17
19
|
buffer = createWasmIdleSharedBuffer(1024);
|
|
@@ -28,6 +30,7 @@ class D {
|
|
|
28
30
|
waitingForInput = false;
|
|
29
31
|
pendingEof = false;
|
|
30
32
|
activeOperation = null;
|
|
33
|
+
lldbAssets = {};
|
|
31
34
|
disposed = false;
|
|
32
35
|
runtimeAssetCache = new RuntimeAssetCache();
|
|
33
36
|
ownsRuntimeAssetCache = true;
|
|
@@ -187,10 +190,11 @@ class D {
|
|
|
187
190
|
if (!this.isOperationActive(operation))
|
|
188
191
|
return;
|
|
189
192
|
let timeout;
|
|
190
|
-
|
|
193
|
+
const cancelTimeout = () => {
|
|
191
194
|
if (timeout !== undefined)
|
|
192
195
|
clearTimeout(timeout);
|
|
193
|
-
}
|
|
196
|
+
};
|
|
197
|
+
operation.cleanups.push(cancelTimeout);
|
|
194
198
|
try {
|
|
195
199
|
timeout = setTimeout(() => {
|
|
196
200
|
if (!this.isOperationActive(operation))
|
|
@@ -208,6 +212,7 @@ class D {
|
|
|
208
212
|
catch (error) {
|
|
209
213
|
this.cancelOperation(operation, error);
|
|
210
214
|
}
|
|
215
|
+
return cancelTimeout;
|
|
211
216
|
}
|
|
212
217
|
resetExplicitStdinState() {
|
|
213
218
|
this.pendingInput = [];
|
|
@@ -238,6 +243,14 @@ class D {
|
|
|
238
243
|
let limits;
|
|
239
244
|
let unbindPreSessionAbort = () => undefined;
|
|
240
245
|
try {
|
|
246
|
+
// Ordinary D execution only needs its compiler bundle. Keep debugger settings
|
|
247
|
+
// across worker retirement, but resolve their URLs only for an LLDB run.
|
|
248
|
+
const assets = typeof runtimeAssets === 'string' ? { rootUrl: runtimeAssets } : runtimeAssets;
|
|
249
|
+
this.lldbAssets = {
|
|
250
|
+
rootUrl: assets.rootUrl,
|
|
251
|
+
debug: assets.debug ? { ...assets.debug } : undefined,
|
|
252
|
+
persistentCache: options.persistentCache ?? assets.persistentCache
|
|
253
|
+
};
|
|
241
254
|
signal = options.signal;
|
|
242
255
|
unbindPreSessionAbort = this.bindPreSessionAbort(activeOperation, signal);
|
|
243
256
|
if (!this.isOperationActive(activeOperation) || signal?.aborted) {
|
|
@@ -361,6 +374,10 @@ class D {
|
|
|
361
374
|
});
|
|
362
375
|
}
|
|
363
376
|
write(input) {
|
|
377
|
+
if (this.lldbSession) {
|
|
378
|
+
void this.lldbSession.write(input);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
364
381
|
if (this.disposed)
|
|
365
382
|
return;
|
|
366
383
|
this.pendingInput.push(input);
|
|
@@ -368,6 +385,10 @@ class D {
|
|
|
368
385
|
this.flushPendingInput();
|
|
369
386
|
}
|
|
370
387
|
eof() {
|
|
388
|
+
if (this.lldbSession) {
|
|
389
|
+
void this.lldbSession.eof();
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
371
392
|
if (this.disposed)
|
|
372
393
|
return;
|
|
373
394
|
this.pendingEof = true;
|
|
@@ -389,6 +410,7 @@ class D {
|
|
|
389
410
|
async run(code, prepare, log = true, progress, args = [], options = {}) {
|
|
390
411
|
if (!this.worker && this.moduleUrl && this.outerIntegrity && !this.disposed) {
|
|
391
412
|
await this.load({
|
|
413
|
+
...this.lldbAssets,
|
|
392
414
|
d: {
|
|
393
415
|
moduleUrl: this.moduleUrl,
|
|
394
416
|
manifestUrl: this.manifestUrl,
|
|
@@ -412,17 +434,30 @@ class D {
|
|
|
412
434
|
}
|
|
413
435
|
let signal;
|
|
414
436
|
let unbindPreSessionAbort = () => undefined;
|
|
437
|
+
let compileArgs;
|
|
415
438
|
let programArgs;
|
|
416
439
|
let limits;
|
|
417
440
|
let workspace;
|
|
418
441
|
let stdin;
|
|
442
|
+
const debugMode = options.debugMode || (options.debug ? 'trace' : 'none');
|
|
419
443
|
try {
|
|
444
|
+
if (debugMode !== 'none' && debugMode !== 'lldb') {
|
|
445
|
+
throw new Error('D debugging requires debugMode: lldb.');
|
|
446
|
+
}
|
|
447
|
+
if (debugMode === 'lldb') {
|
|
448
|
+
requireSharedArrayBuffer('D debugging');
|
|
449
|
+
if (options.workspaceFiles?.some((file) => file.path !== options.activePath)) {
|
|
450
|
+
throw new Error('The packaged D compiler supports one source file per LLDB session.');
|
|
451
|
+
}
|
|
452
|
+
this.configureLldb(this.lldbAssets, options);
|
|
453
|
+
this.prepareLldb(options, 'main.d');
|
|
454
|
+
}
|
|
420
455
|
signal = options.signal;
|
|
421
456
|
unbindPreSessionAbort = this.bindPreSessionAbort(activeOperation, signal);
|
|
422
457
|
if (!this.isOperationActive(activeOperation)) {
|
|
423
458
|
return Promise.reject(this.releaseBeforeSession(activeOperation, 'D execution cancelled'));
|
|
424
459
|
}
|
|
425
|
-
programArgs = resolveSandboxExecutionArgs('D', args, options)
|
|
460
|
+
({ compileArgs, programArgs } = resolveSandboxExecutionArgs('D', args, options));
|
|
426
461
|
limits = resolveExecutionLimits(options.limits);
|
|
427
462
|
const workspaceFiles = options.workspaceFiles ?? [];
|
|
428
463
|
const activePath = options.activePath ?? 'main.d';
|
|
@@ -456,18 +491,19 @@ class D {
|
|
|
456
491
|
let outputBytes = 0;
|
|
457
492
|
const operation = this.workerSession.beginRun(worker, reject);
|
|
458
493
|
const timeoutMs = Math.min(2_147_483_647, limits.compileTimeoutMs + limits.runTimeoutMs);
|
|
459
|
-
this.bindOperationTimeout(activeOperation, timeoutMs);
|
|
494
|
+
const cancelCompileTimeout = this.bindOperationTimeout(activeOperation, timeoutMs);
|
|
460
495
|
this.bindAbortSignal(activeOperation, signal);
|
|
461
496
|
if (!this.isOperationActive(activeOperation))
|
|
462
497
|
return;
|
|
463
498
|
let handler;
|
|
499
|
+
let handedOff = false;
|
|
464
500
|
const ownsRun = () => this.isOperationActive(activeOperation) &&
|
|
465
|
-
this.worker === worker &&
|
|
466
|
-
worker.onmessage === handler &&
|
|
501
|
+
(handedOff || (this.worker === worker && worker.onmessage === handler)) &&
|
|
467
502
|
_uid === this.uid;
|
|
468
503
|
const claimRun = () => {
|
|
469
504
|
if (!ownsRun())
|
|
470
505
|
return false;
|
|
506
|
+
this.lldbPending = false;
|
|
471
507
|
this.finishExplicitStdin(activeOperation);
|
|
472
508
|
this.elapse = Date.now() - this.begin;
|
|
473
509
|
this.exit = true;
|
|
@@ -506,7 +542,34 @@ class D {
|
|
|
506
542
|
if (!ownsRun())
|
|
507
543
|
return;
|
|
508
544
|
try {
|
|
509
|
-
const { output, results, error, buffer, diagnostic, progress } = event.data;
|
|
545
|
+
const { output, results, error, buffer, diagnostic, progress, lldbArtifact } = event.data;
|
|
546
|
+
if (lldbArtifact) {
|
|
547
|
+
cancelCompileTimeout?.();
|
|
548
|
+
handedOff = true;
|
|
549
|
+
const completion = this.startLldb(lldbArtifact, options, programArgs, this.pendingInput, this.pendingEof, (output) => {
|
|
550
|
+
if (!ownsRun())
|
|
551
|
+
return;
|
|
552
|
+
outputBytes += OUTPUT_ENCODER.encode(output).byteLength;
|
|
553
|
+
if (outputBytes > limits.maxOutputBytes) {
|
|
554
|
+
failRun(new OutputLimitError(`D output exceeded ${limits.maxOutputBytes} bytes`, {
|
|
555
|
+
actual: outputBytes,
|
|
556
|
+
limit: limits.maxOutputBytes,
|
|
557
|
+
phase: 'execute',
|
|
558
|
+
runtimeId: 'D'
|
|
559
|
+
}), true);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
this.output?.(output);
|
|
563
|
+
});
|
|
564
|
+
this.pendingEof = false;
|
|
565
|
+
if (this.workerSession.release(worker))
|
|
566
|
+
delete this.worker;
|
|
567
|
+
void completion.then((result) => {
|
|
568
|
+
if (claimRun())
|
|
569
|
+
resolve(result);
|
|
570
|
+
}, (error) => failRun(error));
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
510
573
|
if (buffer && !hasExplicitStdin) {
|
|
511
574
|
this.waitingForInput = true;
|
|
512
575
|
if (!prepare) {
|
|
@@ -612,10 +675,12 @@ class D {
|
|
|
612
675
|
code,
|
|
613
676
|
prepare,
|
|
614
677
|
buffer: this.buffer,
|
|
678
|
+
compileArgs,
|
|
615
679
|
args: programArgs,
|
|
616
680
|
stdin,
|
|
617
681
|
fileName: workspace.activePath,
|
|
618
682
|
log: _log,
|
|
683
|
+
debugMode,
|
|
619
684
|
...(modulePorts.ldc2 ? { compilerModulePorts: modulePorts } : {})
|
|
620
685
|
};
|
|
621
686
|
const transfers = Object.values(modulePorts);
|
|
@@ -639,6 +704,7 @@ class D {
|
|
|
639
704
|
cancelOperation(operation, reason) {
|
|
640
705
|
if (!this.isOperationActive(operation))
|
|
641
706
|
return;
|
|
707
|
+
void this.stopLldb();
|
|
642
708
|
operation.cancelled = true;
|
|
643
709
|
operation.cancellationReason = reason;
|
|
644
710
|
this.activeOperation = null;
|
|
@@ -665,6 +731,7 @@ class D {
|
|
|
665
731
|
this.terminate();
|
|
666
732
|
}
|
|
667
733
|
terminate(reason = 'Process terminated') {
|
|
734
|
+
void this.stopLldb();
|
|
668
735
|
if (this.disposed)
|
|
669
736
|
return;
|
|
670
737
|
const activeOperation = this.activeOperation;
|
|
@@ -695,6 +762,7 @@ class D {
|
|
|
695
762
|
dispose() {
|
|
696
763
|
if (this.disposePromise)
|
|
697
764
|
return this.disposePromise;
|
|
765
|
+
void this.stopLldb();
|
|
698
766
|
this.disposed = true;
|
|
699
767
|
if (this.ownsRuntimeAssetCache)
|
|
700
768
|
this.runtimeAssetCache.dispose();
|
|
@@ -705,6 +773,7 @@ class D {
|
|
|
705
773
|
this.manifestUrl = '';
|
|
706
774
|
this.outerIntegrity = undefined;
|
|
707
775
|
this.activeDAssetsKey = '';
|
|
776
|
+
this.lldbAssets = {};
|
|
708
777
|
this.output = null;
|
|
709
778
|
this.oncompilerdiagnostic = undefined;
|
|
710
779
|
this.resetExplicitStdinState();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Charges execution time while allowing a person to inspect a paused VM. */
|
|
2
|
+
export declare class DebugDeadline {
|
|
3
|
+
private readonly expire;
|
|
4
|
+
private remaining;
|
|
5
|
+
private started;
|
|
6
|
+
private timer?;
|
|
7
|
+
private closed;
|
|
8
|
+
constructor(timeoutMs: number, expire: () => void);
|
|
9
|
+
pause(): void;
|
|
10
|
+
resume(): void;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Charges execution time while allowing a person to inspect a paused VM. */
|
|
2
|
+
export class DebugDeadline {
|
|
3
|
+
expire;
|
|
4
|
+
remaining;
|
|
5
|
+
started = 0;
|
|
6
|
+
timer;
|
|
7
|
+
closed = false;
|
|
8
|
+
constructor(timeoutMs, expire) {
|
|
9
|
+
this.expire = expire;
|
|
10
|
+
this.remaining = timeoutMs;
|
|
11
|
+
this.resume();
|
|
12
|
+
}
|
|
13
|
+
pause() {
|
|
14
|
+
if (this.timer === undefined)
|
|
15
|
+
return;
|
|
16
|
+
clearTimeout(this.timer);
|
|
17
|
+
this.timer = undefined;
|
|
18
|
+
this.remaining = Math.max(0, this.remaining - (Date.now() - this.started));
|
|
19
|
+
}
|
|
20
|
+
resume() {
|
|
21
|
+
if (this.closed || this.timer !== undefined)
|
|
22
|
+
return;
|
|
23
|
+
this.started = Date.now();
|
|
24
|
+
this.timer = setTimeout(() => {
|
|
25
|
+
this.timer = undefined;
|
|
26
|
+
this.closed = true;
|
|
27
|
+
this.expire();
|
|
28
|
+
}, this.remaining);
|
|
29
|
+
}
|
|
30
|
+
dispose() {
|
|
31
|
+
this.pause();
|
|
32
|
+
this.closed = true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** One published command plus a bounded UI queue; consumption wakes the next producer write. */
|
|
2
|
+
export declare class DebugCommandMailbox {
|
|
3
|
+
private readonly label;
|
|
4
|
+
readonly buffer: import("./sharedBuffer").WasmIdleSharedBuffer;
|
|
5
|
+
private queued;
|
|
6
|
+
constructor(label?: string);
|
|
7
|
+
reset(): void;
|
|
8
|
+
send(command: string): void;
|
|
9
|
+
flush(): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function readDebugCommand(buffer: SharedArrayBuffer, blocking: boolean, onConsumed: () => void, label?: string): string | null;
|