wasm-idle 1.1.0 → 1.2.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 +267 -112
- package/dist/container/bash-profile.d.ts +80 -0
- package/dist/container/bash-profile.js +328 -0
- package/dist/container/binding.d.ts +39 -0
- package/dist/container/binding.js +331 -0
- package/dist/container/clang-runtime.d.ts +42 -0
- package/dist/container/clang-runtime.js +561 -0
- package/dist/container/client.d.ts +14 -0
- package/dist/container/client.js +185 -0
- package/dist/container/explorer.d.ts +31 -0
- package/dist/container/explorer.js +112 -0
- 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/container/protocol.d.ts +84 -0
- package/dist/container/protocol.js +28 -0
- package/dist/container/runtime-adapter.d.ts +75 -0
- package/dist/container/runtime-adapter.js +537 -0
- package/dist/container/shell-control.d.ts +49 -0
- package/dist/container/shell-control.js +360 -0
- package/dist/container/workspace.d.ts +12 -0
- package/dist/container/workspace.js +29 -0
- package/dist/index.d.ts +1 -1
- package/dist/playground/assetBridge.js +111 -33
- package/dist/playground/assets.d.ts +10 -2
- package/dist/playground/c3.js +22 -0
- package/dist/playground/c3Memory.d.ts +19 -0
- package/dist/playground/c3Memory.js +117 -0
- package/dist/playground/cachedClang.js +143 -34
- package/dist/playground/clang.d.ts +5 -1
- package/dist/playground/clang.js +61 -5
- package/dist/playground/clangAssetIntegrity.js +6 -6
- package/dist/playground/clangWorkerProtocol.d.ts +12 -1
- package/dist/playground/cobol.d.ts +3 -0
- package/dist/playground/cobol.js +10 -1
- package/dist/playground/commonlispAssets.d.ts +2 -2
- package/dist/playground/compiledArtifactCache.d.ts +3 -1
- package/dist/playground/compiledArtifactCache.js +31 -5
- package/dist/playground/compiledLldb.d.ts +41 -0
- package/dist/playground/compiledLldb.js +167 -0
- package/dist/playground/d.d.ts +10 -2
- package/dist/playground/d.js +161 -14
- 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/dotnet.js +6 -8
- package/dist/playground/fortran.d.ts +3 -0
- package/dist/playground/fortran.js +10 -1
- package/dist/playground/go.js +23 -7
- package/dist/playground/goDebugInstrumentation.js +207 -97
- package/dist/playground/java-debug-FMHDKUN6.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 +162 -5
- 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.d.ts +9 -0
- package/dist/playground/javaRuntimeErrors.js +93 -0
- package/dist/playground/lean4Assets.d.ts +1 -25
- package/dist/playground/lean4Assets.js +2 -123
- package/dist/playground/lfortran.js +10 -0
- package/dist/playground/lfortranAssets.d.ts +2 -2
- package/dist/playground/lldbSession.d.ts +23 -2
- package/dist/playground/lldbSession.js +278 -58
- 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 +30 -0
- package/dist/playground/objectivec.d.ts +10 -6
- package/dist/playground/objectivec.js +85 -10
- package/dist/playground/options.d.ts +12 -4
- package/dist/playground/python.d.ts +8 -1
- package/dist/playground/python.js +89 -6
- 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/runtimeAssetCache.d.ts +1 -32
- package/dist/playground/runtimeAssetCache.js +1 -193
- package/dist/playground/runtimeSession.d.ts +2 -2
- package/dist/playground/runtimeSession.js +11 -11
- package/dist/playground/rust.d.ts +10 -0
- package/dist/playground/rust.js +230 -51
- package/dist/playground/sandbox.d.ts +8 -1
- package/dist/playground/staticStdinRing.d.ts +2 -1
- package/dist/playground/staticStdinRing.js +21 -10
- package/dist/playground/staticWorkerRuntime.d.ts +15 -1
- package/dist/playground/staticWorkerRuntime.js +127 -19
- package/dist/playground/stdinBuffer.d.ts +1 -1
- package/dist/playground/stdinBuffer.js +19 -2
- package/dist/playground/tinygo.d.ts +3 -0
- package/dist/playground/tinygo.js +88 -6
- package/dist/playground/typescript.js +8 -0
- package/dist/playground/v.d.ts +6 -2
- package/dist/playground/v.js +76 -13
- package/dist/playground/wasmAwkVersion.d.ts +13 -13
- package/dist/playground/wasmAwkVersion.js +4 -4
- package/dist/playground/wasmBqnVersion.d.ts +2 -2
- package/dist/playground/wasmBqnVersion.js +2 -2
- package/dist/playground/wasmC3Version.d.ts +2 -2
- package/dist/playground/wasmC3Version.js +2 -2
- package/dist/playground/wasmClojureScriptVersion.d.ts +2 -2
- package/dist/playground/wasmClojureScriptVersion.js +2 -2
- package/dist/playground/wasmCommonLispVersion.d.ts +2 -2
- package/dist/playground/wasmCommonLispVersion.js +2 -2
- package/dist/playground/wasmDIntegrity.d.ts +5 -5
- package/dist/playground/wasmDIntegrity.js +5 -5
- package/dist/playground/wasmDVersion.d.ts +16 -1
- package/dist/playground/wasmDVersion.js +16 -1
- package/dist/playground/wasmDebugVersion.d.ts +1 -1
- package/dist/playground/wasmDebugVersion.js +1 -1
- package/dist/playground/wasmForthVersion.d.ts +2 -2
- package/dist/playground/wasmForthVersion.js +2 -2
- package/dist/playground/wasmGleamVersion.d.ts +2 -2
- package/dist/playground/wasmGleamVersion.js +2 -2
- package/dist/playground/wasmGrainVersion.d.ts +2 -2
- package/dist/playground/wasmGrainVersion.js +2 -2
- package/dist/playground/wasmJVersion.d.ts +2 -2
- package/dist/playground/wasmJVersion.js +2 -2
- package/dist/playground/wasmJanetVersion.js +2 -2
- package/dist/playground/wasmJuliaVersion.js +2 -2
- 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/wasmNimVersion.d.ts +9 -9
- package/dist/playground/wasmNimVersion.js +6 -6
- package/dist/playground/wasmOcamlVersion.d.ts +2 -2
- package/dist/playground/wasmOcamlVersion.js +1 -1
- package/dist/playground/wasmPascalVersion.js +2 -2
- package/dist/playground/wasmPerlVersion.js +2 -2
- package/dist/playground/wasmPrologVersion.d.ts +2 -2
- package/dist/playground/wasmPrologVersion.js +2 -2
- package/dist/playground/wasmReScriptVersion.d.ts +2 -2
- package/dist/playground/wasmReScriptVersion.js +2 -2
- package/dist/playground/wasmRustVersion.d.ts +26 -38
- package/dist/playground/wasmRustVersion.js +25 -40
- package/dist/playground/wasmTclVersion.d.ts +4 -4
- package/dist/playground/wasmTclVersion.js +2 -2
- package/dist/playground/wasmTinyGoVersion.d.ts +14 -14
- package/dist/playground/wasmTinyGoVersion.js +14 -14
- package/dist/playground/wasmTypeScriptVersion.d.ts +5 -5
- package/dist/playground/wasmTypeScriptVersion.js +5 -5
- package/dist/playground/worker/cachedClangCompile.js +52 -4
- package/dist/playground/worker/cachedClangExecute.js +6 -5
- package/dist/playground/worker/clang.js +33 -11
- package/dist/playground/worker/cobol.js +3 -3
- package/dist/playground/worker/d.js +63 -7
- package/dist/playground/worker/fortran.js +3 -3
- package/dist/playground/worker/go.js +16 -5
- package/dist/playground/worker/haskell.js +10 -7
- package/dist/playground/worker/java.js +263 -45
- 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 +15 -3
- package/dist/playground/worker/php.js +15 -9
- package/dist/playground/worker/python.js +102 -30
- package/dist/playground/worker/pythonExecution.js +17 -1
- package/dist/playground/worker/pythonWorkspaceFiles.d.ts +6 -0
- package/dist/playground/worker/pythonWorkspaceFiles.js +26 -0
- package/dist/playground/worker/pythonWorkspaceImports.d.ts +4 -0
- package/dist/playground/worker/pythonWorkspaceImports.js +129 -0
- package/dist/playground/worker/r.js +13 -6
- 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 +38 -3
- package/dist/playground/worker/sqlite.js +4 -3
- package/dist/playground/worker/tinygo.js +11 -3
- package/dist/playground/worker/typescript.js +2 -3
- package/dist/playground/worker/v.js +32 -7
- package/dist/playground/worker/wat.js +2 -3
- package/dist/playground/worker/zig.js +20 -6
- package/dist/playground/workerSession.d.ts +1 -28
- package/dist/playground/workerSession.js +1 -164
- package/dist/playground/zig.js +4 -0
- package/package.json +66 -15
- package/dist/playground/worker/python.runtime.cases.d.ts +0 -1
- package/dist/playground/worker/python.runtime.cases.js +0 -374
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);
|
|
@@ -7,10 +7,10 @@ export const BUNDLED_CLANG_ASSET_INTEGRITY = Object.freeze({
|
|
|
7
7
|
'runtime-manifest.v1.json': integrityEntry(967, '0b854bc6b41924420cfcc840509ecbe03af3c63ca3edd4940897917e32c8d8ad'),
|
|
8
8
|
'libc-printscan-long-double.a.gz': integrityEntry(52_723, 'b3f11e17e40fb13371a97244fdde00d5bd951ad8e20dfdf88a069167d6be628b', 111_062, '33e04007d3547095068391b42189d1ac5398dd04e9da3118dfa644ffea7f4148'),
|
|
9
9
|
'bin/memfs.wasm.gz': integrityEntry(16_111, 'a3e43451bc15ae69a7f113009e2ee82ab4db711625c1782cd45d0d3c4d38175a', 38_071, '5b741e03dd3502bcfd80e4e5055232b5d633604e1461752efed0189f93407dc3'),
|
|
10
|
-
'bin/clang.wasm.gz': integrityEntry(
|
|
11
|
-
'bin/lld.wasm.gz': integrityEntry(
|
|
12
|
-
'bin/sysroot.tar.gz': integrityEntry(
|
|
13
|
-
'bin/c-sysroot.tar.gz': integrityEntry(
|
|
14
|
-
'bin/cpp-addon.tar.gz': integrityEntry(
|
|
15
|
-
'language-sysroots.v1.json': integrityEntry(
|
|
10
|
+
'bin/clang.wasm.gz': integrityEntry(13_124_999, 'cc7b6b229af392f439a1ca89dbb8d5e016792264a0a6ee59608ff24e269be982', 35_597_829, 'fe7c40c2369d4a1b91d87cd2a38b1a5be11cd7f381373b7888be0b5f209e2d5b'),
|
|
11
|
+
'bin/lld.wasm.gz': integrityEntry(6_421_841, '798ce825f3e3cf9a695b6a049f157ba28d38731a3dc5e699ccdf23d69d3a5c20', 16_136_490, '77949fed32d5481979b8ebe6081009e3ec69c7219cb355e3f388a316746ea9b7'),
|
|
12
|
+
'bin/sysroot.tar.gz': integrityEntry(6_780_412, '6188b500fa7af2dceadcbd6dcf2619b6935fa94c224c1c2078426666ebea1d50', 35_594_240, 'fb6d8a8786ec395009d44f62ff24a5bf09ff8672340b7dae9f48e28cf1569cba'),
|
|
13
|
+
'bin/c-sysroot.tar.gz': integrityEntry(2_006_388, 'da7a29250b2fe2d928fa8818069ff67e1dcb26c529bbf01f40bbeb251535ecaa', 12_213_760, '517b32208f4e556b22eb5ac775411c39fb75239dfaf81f206e6052e168425b62'),
|
|
14
|
+
'bin/cpp-addon.tar.gz': integrityEntry(4_776_509, '6e243c219561b1f5aad64db4a9ff8bbeb85a97b5e3b5df3ed71d8340d35a8cd7', 23_382_528, 'feaf2aa538623ec8c543ccb49e9a833d2a1aa6dee7a9ad502c277deba24ef642'),
|
|
15
|
+
'language-sysroots.v1.json': integrityEntry(426_858, '08f6c2c87b4bebc9599193334e1d0ed322ebb38cbdd2bbb83d2b8c3a4cb61263')
|
|
16
16
|
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { BrowserClangArtifact, BrowserClangCompileProgress, BrowserClangCompileRequest, BrowserClangPrecompiledHeader, BrowserClangWorkspaceFile } from '@wasm-idle/llvm-core/clang';
|
|
2
|
+
import type { CompilerDiagnostic } from '@wasm-idle/llvm-core/clang';
|
|
2
3
|
import type { WorkerRuntimeAssetConfig } from './worker/assets';
|
|
3
4
|
export type ClangCompileWorkerRequest = {
|
|
4
5
|
request: Omit<BrowserClangCompileRequest, 'onProgress'>;
|
|
5
6
|
runtimeBaseUrl: string;
|
|
6
7
|
maxAssetBytes?: number;
|
|
8
|
+
maxOutputBytes?: number;
|
|
7
9
|
languageSysroots?: boolean;
|
|
8
10
|
log?: boolean;
|
|
9
11
|
assets: WorkerRuntimeAssetConfig;
|
|
@@ -23,18 +25,27 @@ export type ClangCompileWorkerResponse = {
|
|
|
23
25
|
artifact: BrowserClangArtifact;
|
|
24
26
|
stdout: string;
|
|
25
27
|
stderr: string;
|
|
28
|
+
diagnostics?: CompilerDiagnostic[];
|
|
26
29
|
precompiledHeader?: 'building';
|
|
27
|
-
} | {
|
|
30
|
+
} | ({
|
|
28
31
|
type: 'error';
|
|
29
32
|
error: string;
|
|
30
33
|
stdout: string;
|
|
31
34
|
stderr: string;
|
|
35
|
+
diagnostics?: CompilerDiagnostic[];
|
|
32
36
|
precompiledHeader?: 'building';
|
|
37
|
+
} & ({
|
|
38
|
+
code?: undefined;
|
|
33
39
|
} | {
|
|
40
|
+
code: 'output-limit';
|
|
41
|
+
limit: number;
|
|
42
|
+
actual: number;
|
|
43
|
+
})) | {
|
|
34
44
|
type: 'precompiled-header';
|
|
35
45
|
header?: BrowserClangPrecompiledHeader;
|
|
36
46
|
};
|
|
37
47
|
export type ClangExecuteWorkerRequest = {
|
|
48
|
+
maxWasmMemoryBytes?: number;
|
|
38
49
|
artifact: BrowserClangArtifact;
|
|
39
50
|
programArgs?: string[];
|
|
40
51
|
env?: Record<string, string>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WorkerAssetBridge } from './assetBridge';
|
|
2
|
+
import type { RuntimeAssetCache } from './runtimeAssetCache';
|
|
2
3
|
import { type PlaygroundRuntimeAssets } from './assets';
|
|
3
4
|
import type { SandboxExecutionOptions } from './options';
|
|
4
5
|
import type { Sandbox, SandboxProgress } from './sandbox';
|
|
@@ -18,10 +19,12 @@ declare class Cobol implements Sandbox {
|
|
|
18
19
|
assetBridge: WorkerAssetBridge | null;
|
|
19
20
|
activeCobolBaseUrl: string;
|
|
20
21
|
private activeOperation;
|
|
22
|
+
private runtimeAssetCache?;
|
|
21
23
|
private disposed;
|
|
22
24
|
private disposePromise;
|
|
23
25
|
private readonly disposeCancellation;
|
|
24
26
|
private readonly workerSession;
|
|
27
|
+
setRuntimeAssetCache(cache: RuntimeAssetCache): void;
|
|
25
28
|
private beginOperation;
|
|
26
29
|
private isOperationActive;
|
|
27
30
|
private releaseOperation;
|
package/dist/playground/cobol.js
CHANGED
|
@@ -26,6 +26,7 @@ class Cobol {
|
|
|
26
26
|
assetBridge = null;
|
|
27
27
|
activeCobolBaseUrl = '';
|
|
28
28
|
activeOperation = null;
|
|
29
|
+
runtimeAssetCache;
|
|
29
30
|
disposed = false;
|
|
30
31
|
disposePromise = null;
|
|
31
32
|
disposeCancellation = new CancelledError('COBOL sandbox disposed', {
|
|
@@ -53,6 +54,14 @@ class Cobol {
|
|
|
53
54
|
this.pendingEof = false;
|
|
54
55
|
}
|
|
55
56
|
});
|
|
57
|
+
setRuntimeAssetCache(cache) {
|
|
58
|
+
if (this.runtimeAssetCache === cache)
|
|
59
|
+
return;
|
|
60
|
+
if (this.disposed || this.worker || this.activeOperation) {
|
|
61
|
+
throw new RuntimeConfigurationError('Cannot replace an active COBOL compiler cache');
|
|
62
|
+
}
|
|
63
|
+
this.runtimeAssetCache = cache;
|
|
64
|
+
}
|
|
56
65
|
beginOperation(phase) {
|
|
57
66
|
if (this.disposed) {
|
|
58
67
|
throw new RuntimeConfigurationError('COBOL sandbox is disposed', {
|
|
@@ -303,7 +312,7 @@ class Cobol {
|
|
|
303
312
|
}
|
|
304
313
|
let assetBridge;
|
|
305
314
|
try {
|
|
306
|
-
assetBridge = new WorkerAssetBridge(worker, 'clang', clangAssets, progress, limits.maxAssetBytes);
|
|
315
|
+
assetBridge = new WorkerAssetBridge(worker, 'clang', clangAssets, progress, limits.maxAssetBytes, false, this.runtimeAssetCache);
|
|
307
316
|
}
|
|
308
317
|
catch (error) {
|
|
309
318
|
try {
|
|
@@ -10,8 +10,8 @@ export declare function resolveCommonLispRuntimeAssetConfig(assets: string | Pla
|
|
|
10
10
|
workerUrl: string;
|
|
11
11
|
manifestFingerprint: "56f1eb7cf6470619cb3393e99d5c8ad1841a001ab758f388c006ca1d801ba071";
|
|
12
12
|
workerReceipt: {
|
|
13
|
-
readonly bytes:
|
|
14
|
-
readonly sha256: "
|
|
13
|
+
readonly bytes: 12104;
|
|
14
|
+
readonly sha256: "d179242c40cdce862ff45bb35f736eaf8e79b97bdc06754576406ad4de698b7d";
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
export declare function preflightCommonLispRuntimeAssets(baseUrl: string, options: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BrowserClangArtifact, BrowserClangCompileRequest } from '@wasm-idle/llvm-core/clang';
|
|
2
|
+
import type { CompilerDiagnostic } from '@wasm-idle/llvm-core/clang';
|
|
2
3
|
/** Only immutable compiler output lives here, never a worker, instance, or filesystem. */
|
|
3
4
|
export declare class CompiledArtifactCache {
|
|
4
5
|
private entries;
|
|
@@ -9,7 +10,8 @@ export declare class CompiledArtifactCache {
|
|
|
9
10
|
private maxBytes;
|
|
10
11
|
constructor(maxEntries?: number, maxBytes?: number);
|
|
11
12
|
get(key: string): BrowserClangArtifact | undefined;
|
|
12
|
-
|
|
13
|
+
getDiagnostics(key: string): CompilerDiagnostic[];
|
|
14
|
+
set(key: string, artifact: BrowserClangArtifact, diagnostics?: CompilerDiagnostic[]): void;
|
|
13
15
|
clear(): void;
|
|
14
16
|
stats(): {
|
|
15
17
|
hits: number;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
function snapshotArtifact(artifact) {
|
|
2
|
+
const { bytes, wasm, ...metadata } = artifact;
|
|
3
|
+
return {
|
|
4
|
+
...structuredClone(metadata),
|
|
5
|
+
// Compiled modules are immutable. Byte views must not retain an oversized backing buffer.
|
|
6
|
+
wasm,
|
|
7
|
+
bytes: ArrayBuffer.isView(bytes) ? Uint8Array.from(bytes) : bytes.slice(0)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
1
10
|
/** Only immutable compiler output lives here, never a worker, instance, or filesystem. */
|
|
2
11
|
export class CompiledArtifactCache {
|
|
3
12
|
entries = new Map();
|
|
@@ -7,6 +16,10 @@ export class CompiledArtifactCache {
|
|
|
7
16
|
maxEntries;
|
|
8
17
|
maxBytes;
|
|
9
18
|
constructor(maxEntries = 8, maxBytes = 32 * 1024 * 1024) {
|
|
19
|
+
if (!Number.isSafeInteger(maxEntries) || maxEntries < 0)
|
|
20
|
+
throw new TypeError('Invalid compiled artifact cache maxEntries');
|
|
21
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0)
|
|
22
|
+
throw new TypeError('Invalid compiled artifact cache maxBytes');
|
|
10
23
|
this.maxEntries = maxEntries;
|
|
11
24
|
this.maxBytes = maxBytes;
|
|
12
25
|
}
|
|
@@ -19,17 +32,29 @@ export class CompiledArtifactCache {
|
|
|
19
32
|
this.hits++;
|
|
20
33
|
this.entries.delete(key);
|
|
21
34
|
this.entries.set(key, entry);
|
|
22
|
-
return entry.artifact;
|
|
35
|
+
return snapshotArtifact(entry.artifact);
|
|
36
|
+
}
|
|
37
|
+
getDiagnostics(key) {
|
|
38
|
+
return this.entries.get(key)?.diagnostics.map((diagnostic) => ({ ...diagnostic })) ?? [];
|
|
23
39
|
}
|
|
24
|
-
set(key, artifact) {
|
|
25
|
-
|
|
40
|
+
set(key, artifact, diagnostics = []) {
|
|
41
|
+
// A zero budget disables retention without disabling compilation.
|
|
42
|
+
if (this.maxEntries === 0 || this.maxBytes === 0)
|
|
43
|
+
return;
|
|
44
|
+
const size = artifact.bytes.byteLength +
|
|
45
|
+
key.length * 2 +
|
|
46
|
+
(diagnostics.length ? JSON.stringify(diagnostics).length * 2 : 0);
|
|
26
47
|
if (size > this.maxBytes)
|
|
27
48
|
return;
|
|
28
49
|
const old = this.entries.get(key);
|
|
29
50
|
if (old)
|
|
30
51
|
this.bytes -= old.size;
|
|
31
52
|
this.entries.delete(key);
|
|
32
|
-
this.entries.set(key, {
|
|
53
|
+
this.entries.set(key, {
|
|
54
|
+
artifact: snapshotArtifact(artifact),
|
|
55
|
+
diagnostics: diagnostics.map((diagnostic) => ({ ...diagnostic })),
|
|
56
|
+
size
|
|
57
|
+
});
|
|
33
58
|
this.bytes += size;
|
|
34
59
|
while (this.entries.size > this.maxEntries || this.bytes > this.maxBytes) {
|
|
35
60
|
const oldest = this.entries.keys().next().value;
|
|
@@ -52,7 +77,7 @@ export class CompiledArtifactCache {
|
|
|
52
77
|
}
|
|
53
78
|
export function clangCompileKey(runtimeBaseUrl, maxAssetBytes, request, languageSysroots = false) {
|
|
54
79
|
return JSON.stringify([
|
|
55
|
-
'wasm-idle/clang-cache-
|
|
80
|
+
'wasm-idle/clang-cache-v3',
|
|
56
81
|
runtimeBaseUrl,
|
|
57
82
|
maxAssetBytes,
|
|
58
83
|
languageSysroots,
|
|
@@ -62,6 +87,7 @@ export function clangCompileKey(runtimeBaseUrl, maxAssetBytes, request, language
|
|
|
62
87
|
request.compileArgs,
|
|
63
88
|
request.cVersion,
|
|
64
89
|
request.cppVersion,
|
|
90
|
+
request.maxWasmMemoryBytes,
|
|
65
91
|
[...(request.workspaceFiles || [])].sort((a, b) => a.path.localeCompare(b.path))
|
|
66
92
|
]);
|
|
67
93
|
}
|
|
@@ -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,7 +1,10 @@
|
|
|
1
1
|
import { type PlaygroundRuntimeAssets, type ResolvedDRuntimeAssetConfig } from './assets';
|
|
2
|
+
import { CompiledLldbSandbox } from './compiledLldb';
|
|
3
|
+
import { RuntimeAssetCache } from '@wasm-idle/core';
|
|
2
4
|
import { type CompilerDiagnostic, type SandboxExecutionOptions } from './options';
|
|
3
5
|
import type { Sandbox, SandboxProgress } from './sandbox';
|
|
4
|
-
declare class D implements Sandbox {
|
|
6
|
+
declare class D extends CompiledLldbSandbox implements Sandbox {
|
|
7
|
+
protected lldbEntryFunction: string;
|
|
5
8
|
output: any;
|
|
6
9
|
worker?: Worker;
|
|
7
10
|
buffer: import("./sharedBuffer").WasmIdleSharedBuffer;
|
|
@@ -18,7 +21,10 @@ declare class D implements Sandbox {
|
|
|
18
21
|
waitingForInput: boolean;
|
|
19
22
|
pendingEof: boolean;
|
|
20
23
|
private activeOperation;
|
|
24
|
+
private lldbAssets;
|
|
21
25
|
private disposed;
|
|
26
|
+
private runtimeAssetCache;
|
|
27
|
+
private ownsRuntimeAssetCache;
|
|
22
28
|
private disposePromise;
|
|
23
29
|
private readonly disposeCancellation;
|
|
24
30
|
private readonly workerSession;
|
|
@@ -37,8 +43,10 @@ declare class D implements Sandbox {
|
|
|
37
43
|
write(input: string): void;
|
|
38
44
|
eof(): void;
|
|
39
45
|
private flushPendingInput;
|
|
40
|
-
run(code: string, prepare: boolean,
|
|
46
|
+
run(code: string, prepare: boolean, log?: boolean, progress?: SandboxProgress, args?: string[], options?: SandboxExecutionOptions): Promise<boolean | string>;
|
|
47
|
+
private runLoaded;
|
|
41
48
|
private cancelOperation;
|
|
49
|
+
setRuntimeAssetCache(cache: RuntimeAssetCache): void;
|
|
42
50
|
kill(): void;
|
|
43
51
|
terminate(reason?: unknown): void;
|
|
44
52
|
clear(): Promise<void>;
|