warpo 2.5.0-alpha-3 → 3.1.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.
Files changed (110) hide show
  1. package/asconfig.schema.json +13 -0
  2. package/dist/debug_server/debugSession.d.ts +17 -1
  3. package/dist/debug_server/debugSession.js +169 -7
  4. package/dist/debug_server/debugSession.js.map +1 -1
  5. package/dist/debug_server/debugger.d.ts +25 -0
  6. package/dist/debug_server/debugger.js +4 -0
  7. package/dist/debug_server/debugger.js.map +1 -0
  8. package/dist/debug_server/debuggerWasmModule.d.ts +28 -0
  9. package/dist/debug_server/debuggerWasmModule.js +75 -0
  10. package/dist/debug_server/debuggerWasmModule.js.map +1 -0
  11. package/dist/debug_server/nodeDebugger.d.ts +27 -0
  12. package/dist/debug_server/nodeDebugger.js +240 -0
  13. package/dist/debug_server/nodeDebugger.js.map +1 -0
  14. package/dist/debug_server/tests/debugSession.test.js +45 -1
  15. package/dist/debug_server/tests/debugSession.test.js.map +1 -1
  16. package/dist/debug_server/tests/testModule/debugger_basic.d.ts +1 -0
  17. package/dist/debug_server/tests/testModule/debugger_basic.js +6 -0
  18. package/dist/debug_server/tests/testModule/debugger_basic.js.map +1 -0
  19. package/dist/debug_server/wasmEntry.d.ts +1 -0
  20. package/dist/debug_server/wasmEntry.js +36 -0
  21. package/dist/debug_server/wasmEntry.js.map +1 -0
  22. package/dist/heap_analyzer/src/comparison.d.ts +2 -0
  23. package/dist/heap_analyzer/src/comparison.js +77 -0
  24. package/dist/heap_analyzer/src/comparison.js.map +1 -0
  25. package/dist/heap_analyzer/src/constants.d.ts +21 -0
  26. package/dist/heap_analyzer/src/constants.js +30 -0
  27. package/dist/heap_analyzer/src/constants.js.map +1 -0
  28. package/dist/heap_analyzer/src/debugInfoResolver.d.ts +30 -0
  29. package/dist/heap_analyzer/src/debugInfoResolver.js +334 -0
  30. package/dist/heap_analyzer/src/debugInfoResolver.js.map +1 -0
  31. package/dist/heap_analyzer/src/dominator.d.ts +17 -0
  32. package/dist/heap_analyzer/src/dominator.js +149 -0
  33. package/dist/heap_analyzer/src/dominator.js.map +1 -0
  34. package/dist/heap_analyzer/src/dumpReader.d.ts +2 -0
  35. package/dist/heap_analyzer/src/dumpReader.js +34 -0
  36. package/dist/heap_analyzer/src/dumpReader.js.map +1 -0
  37. package/dist/heap_analyzer/src/dwarfParser.d.ts +138 -0
  38. package/dist/heap_analyzer/src/dwarfParser.js +400 -0
  39. package/dist/heap_analyzer/src/dwarfParser.js.map +1 -0
  40. package/dist/heap_analyzer/src/index.d.ts +7 -0
  41. package/dist/heap_analyzer/src/index.js +16 -0
  42. package/dist/heap_analyzer/src/index.js.map +1 -0
  43. package/dist/heap_analyzer/src/referenceScanner.d.ts +11 -0
  44. package/dist/heap_analyzer/src/referenceScanner.js +174 -0
  45. package/dist/heap_analyzer/src/referenceScanner.js.map +1 -0
  46. package/dist/heap_analyzer/src/retainedSize.d.ts +9 -0
  47. package/dist/heap_analyzer/src/retainedSize.js +78 -0
  48. package/dist/heap_analyzer/src/retainedSize.js.map +1 -0
  49. package/dist/heap_analyzer/src/roots.d.ts +10 -0
  50. package/dist/heap_analyzer/src/roots.js +52 -0
  51. package/dist/heap_analyzer/src/roots.js.map +1 -0
  52. package/dist/heap_analyzer/src/snapshot.d.ts +2 -0
  53. package/dist/heap_analyzer/src/snapshot.js +118 -0
  54. package/dist/heap_analyzer/src/snapshot.js.map +1 -0
  55. package/dist/heap_analyzer/src/tlsf.d.ts +18 -0
  56. package/dist/heap_analyzer/src/tlsf.js +48 -0
  57. package/dist/heap_analyzer/src/tlsf.js.map +1 -0
  58. package/dist/heap_analyzer/src/types.d.ts +113 -0
  59. package/dist/heap_analyzer/src/types.js +25 -0
  60. package/dist/heap_analyzer/src/types.js.map +1 -0
  61. package/dist/heap_analyzer/tests/comparison.test.d.ts +1 -0
  62. package/dist/heap_analyzer/tests/comparison.test.js +121 -0
  63. package/dist/heap_analyzer/tests/comparison.test.js.map +1 -0
  64. package/dist/heap_analyzer/tests/debugInfoResolver.test.d.ts +1 -0
  65. package/dist/heap_analyzer/tests/debugInfoResolver.test.js +205 -0
  66. package/dist/heap_analyzer/tests/debugInfoResolver.test.js.map +1 -0
  67. package/dist/heap_analyzer/tests/dominator.test.d.ts +1 -0
  68. package/dist/heap_analyzer/tests/dominator.test.js +438 -0
  69. package/dist/heap_analyzer/tests/dominator.test.js.map +1 -0
  70. package/dist/heap_analyzer/tests/dumpReader.test.d.ts +1 -0
  71. package/dist/heap_analyzer/tests/dumpReader.test.js +61 -0
  72. package/dist/heap_analyzer/tests/dumpReader.test.js.map +1 -0
  73. package/dist/heap_analyzer/tests/dwarfParser.test.d.ts +1 -0
  74. package/dist/heap_analyzer/tests/dwarfParser.test.js +292 -0
  75. package/dist/heap_analyzer/tests/dwarfParser.test.js.map +1 -0
  76. package/dist/heap_analyzer/tests/fixture/dwarfFixture.d.ts +2 -0
  77. package/dist/heap_analyzer/tests/fixture/dwarfFixture.js +266 -0
  78. package/dist/heap_analyzer/tests/fixture/dwarfFixture.js.map +1 -0
  79. package/dist/heap_analyzer/tests/retainedSize.test.d.ts +1 -0
  80. package/dist/heap_analyzer/tests/retainedSize.test.js +57 -0
  81. package/dist/heap_analyzer/tests/retainedSize.test.js.map +1 -0
  82. package/dist/heap_analyzer/tests/roots.test.d.ts +1 -0
  83. package/dist/heap_analyzer/tests/roots.test.js +88 -0
  84. package/dist/heap_analyzer/tests/roots.test.js.map +1 -0
  85. package/dist/heap_analyzer/tests/snapshot.test.d.ts +1 -0
  86. package/dist/heap_analyzer/tests/snapshot.test.js +106 -0
  87. package/dist/heap_analyzer/tests/snapshot.test.js.map +1 -0
  88. package/dist/heap_analyzer/tests/testHelper.d.ts +18 -0
  89. package/dist/heap_analyzer/tests/testHelper.js +68 -0
  90. package/dist/heap_analyzer/tests/testHelper.js.map +1 -0
  91. package/dist/heap_analyzer/tests/tlsf.test.d.ts +1 -0
  92. package/dist/heap_analyzer/tests/tlsf.test.js +98 -0
  93. package/dist/heap_analyzer/tests/tlsf.test.js.map +1 -0
  94. package/dist/heap_analyzer/tests/wasmExecutor.d.ts +9 -0
  95. package/dist/heap_analyzer/tests/wasmExecutor.js +50 -0
  96. package/dist/heap_analyzer/tests/wasmExecutor.js.map +1 -0
  97. package/dist/scripts/lib.d.ts +5 -1
  98. package/dist/scripts/lib.js +171 -24
  99. package/dist/scripts/lib.js.map +1 -1
  100. package/dist/test_runner/core/compiler.js +0 -1
  101. package/dist/test_runner/core/compiler.js.map +1 -1
  102. package/dist/warpo.d.ts +12 -1
  103. package/dist/warpo.js +32 -7
  104. package/dist/warpo.js.map +1 -1
  105. package/dist/warpo_internal.d.ts +1 -1
  106. package/dist/warpo_internal.js +23 -14
  107. package/dist/warpo_internal.js.map +1 -1
  108. package/package.json +17 -4
  109. package/types/std/index.d.ts +0 -4
  110. package/types/warpo/index.d.ts +8 -0
@@ -49,6 +49,19 @@
49
49
  "type": "integer",
50
50
  "description": "Initial memory size for the WebAssembly module, in WebAssembly pages."
51
51
  },
52
+ "maximumMemory": {
53
+ "description": "Maximum memory limit with optional unit suffix. If smaller than one WebAssembly page, it is applied as lowMemoryLimit; otherwise it must be an exact multiple of one WebAssembly page and is converted to maximumMemory pages.",
54
+ "oneOf": [
55
+ {
56
+ "type": "integer",
57
+ "description": "Memory size in bytes."
58
+ },
59
+ {
60
+ "type": "string",
61
+ "description": "Memory size with unit suffix, e.g. 64KiB, 1MiB, 2MB, 3pages."
62
+ }
63
+ ]
64
+ },
52
65
  "stackSize": {
53
66
  "type": "integer",
54
67
  "description": "Stack size for the WebAssembly module, in bytes."
@@ -2,18 +2,34 @@ import { LoggingDebugSession } from "@vscode/debugadapter";
2
2
  import type { DebugProtocol } from "@vscode/debugprotocol";
3
3
  interface WarpoLaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
4
4
  program: string;
5
+ launchType?: string;
6
+ runtime?: string;
7
+ entryFunctionName?: string;
8
+ args?: number[];
5
9
  }
6
10
  export declare class WarpoDebugSession extends LoggingDebugSession {
7
11
  private static threadId;
8
12
  private breakpointId;
9
- private breakpoints;
13
+ private requestedBreakpointsBySource;
14
+ private pendingBreakpointUpdatesBySource;
15
+ private loadedModule;
16
+ private runtime;
10
17
  private log;
18
+ private normalizeSourcePath;
19
+ private sendStoppedEvent;
20
+ private handleRuntimePause;
11
21
  protected initializeRequest(response: DebugProtocol.InitializeResponse, _args: DebugProtocol.InitializeRequestArguments): void;
12
22
  protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): void;
13
23
  protected configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse, _args: DebugProtocol.ConfigurationDoneArguments): void;
14
24
  protected launchRequest(response: DebugProtocol.LaunchResponse, args: WarpoLaunchRequestArguments): void;
25
+ private doLaunchRequest;
15
26
  protected threadsRequest(response: DebugProtocol.ThreadsResponse): void;
27
+ protected continueRequest(response: DebugProtocol.ContinueResponse, _args: DebugProtocol.ContinueArguments): void;
16
28
  protected disconnectRequest(response: DebugProtocol.DisconnectResponse, _args: DebugProtocol.DisconnectArguments): void;
29
+ private doContinueRequest;
17
30
  private logAllBreakpoints;
31
+ private requestBreakpointUpdate;
32
+ private applyPendingBreakpointUpdates;
33
+ private disposeLoadedModule;
18
34
  }
19
35
  export {};
@@ -1,24 +1,52 @@
1
1
  // Copyright (C) 2025 wasm-ecosystem
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { LoggingDebugSession, InitializedEvent, Thread, Breakpoint, logger } from "@vscode/debugadapter";
3
+ import { LoggingDebugSession, InitializedEvent, Thread, Breakpoint, LoadedSourceEvent, StoppedEvent, ContinuedEvent, logger, } from "@vscode/debugadapter";
4
4
  import * as path from "node:path";
5
+ import { NodeDebugger } from "./nodeDebugger.js";
5
6
  export class WarpoDebugSession extends LoggingDebugSession {
6
7
  static threadId = 1;
7
8
  breakpointId = 0;
8
- breakpoints = new Map();
9
+ requestedBreakpointsBySource = new Map();
10
+ pendingBreakpointUpdatesBySource = new Map();
11
+ loadedModule;
12
+ runtime;
9
13
  log(msg) {
10
14
  logger.log(msg);
11
15
  }
16
+ normalizeSourcePath(filePath) {
17
+ if (filePath === "") {
18
+ return "";
19
+ }
20
+ return path.resolve(filePath).replaceAll("\\", "/");
21
+ }
22
+ sendStoppedEvent(runtime, info) {
23
+ this.log(`[${runtime.name}] Paused: ${info.reason}`);
24
+ const reason = info.reason === "breakpoint" ? "breakpoint" : "pause";
25
+ this.sendEvent(new StoppedEvent(reason, WarpoDebugSession.threadId, info.reason));
26
+ }
27
+ handleRuntimePause(runtime, info) {
28
+ this.applyPendingBreakpointUpdates(runtime, () => {
29
+ if (info.reason === "other") {
30
+ void runtime.resume().catch((error) => {
31
+ const message = error instanceof Error ? error.message : "unknown error";
32
+ this.log(`Failed to resume after breakpoint update: ${message}`);
33
+ });
34
+ return;
35
+ }
36
+ this.sendStoppedEvent(runtime, info);
37
+ });
38
+ }
12
39
  initializeRequest(response, _args) {
13
40
  response.body = response.body || {};
14
41
  response.body.supportsConfigurationDoneRequest = true;
15
42
  response.body.supportsSetVariable = false;
16
43
  response.body.supportsBreakpointLocationsRequest = false;
44
+ response.body.supportsLoadedSourcesRequest = true;
17
45
  this.sendResponse(response);
18
46
  this.sendEvent(new InitializedEvent());
19
47
  }
20
48
  setBreakPointsRequest(response, args) {
21
- const sourcePath = args.source.path || "";
49
+ const sourcePath = this.normalizeSourcePath(args.source.path || "");
22
50
  const clientLines = args.breakpoints || [];
23
51
  const bps = clientLines.map((bp) => {
24
52
  const id = ++this.breakpointId;
@@ -31,7 +59,8 @@ export class WarpoDebugSession extends LoggingDebugSession {
31
59
  this.log(`Breakpoint set: ${path.basename(sourcePath)}:${bp.line}`);
32
60
  return info;
33
61
  });
34
- this.breakpoints.set(sourcePath, bps);
62
+ this.requestedBreakpointsBySource.set(sourcePath, bps);
63
+ this.pendingBreakpointUpdatesBySource.set(sourcePath, [...bps]);
35
64
  const breakpoints = bps.map((bp) => {
36
65
  const dbp = new Breakpoint(bp.verified, bp.line);
37
66
  dbp.id = bp.id;
@@ -39,14 +68,63 @@ export class WarpoDebugSession extends LoggingDebugSession {
39
68
  });
40
69
  response.body = { breakpoints };
41
70
  this.sendResponse(response);
71
+ this.requestBreakpointUpdate();
42
72
  }
43
73
  configurationDoneRequest(response, _args) {
44
74
  super.configurationDoneRequest(response, _args);
45
75
  this.logAllBreakpoints();
46
76
  }
47
77
  launchRequest(response, args) {
48
- this.log(`Launch requested for: ${args.program}`);
49
- this.sendResponse(response);
78
+ void this.doLaunchRequest(response, args);
79
+ }
80
+ async doLaunchRequest(response, args) {
81
+ try {
82
+ this.log(`Launch requested for: ${args.program}`);
83
+ const launchType = args.launchType ?? "wasm file";
84
+ if (launchType === "wasm file") {
85
+ const runtimeName = args.runtime ?? "node";
86
+ let runtime;
87
+ if (runtimeName === "node") {
88
+ runtime = new NodeDebugger();
89
+ }
90
+ else {
91
+ this.sendErrorResponse(response, 1, `Unknown runtime "${runtimeName}"`);
92
+ return;
93
+ }
94
+ runtime.onModuleLoad = (module) => {
95
+ this.loadedModule = module;
96
+ this.log(`Wasm module loaded: ${module.wasmFilePath} (reported as ${module.url}, scriptId: ${module.scriptId})`);
97
+ this.sendEvent(new LoadedSourceEvent("new", {
98
+ name: path.basename(module.wasmFilePath),
99
+ path: module.wasmFilePath,
100
+ }));
101
+ this.sendEvent(new LoadedSourceEvent("new", {
102
+ name: path.basename(module.sourceMapFilePath),
103
+ path: module.sourceMapFilePath,
104
+ }));
105
+ this.applyPendingBreakpointUpdates(runtime, () => {
106
+ runtime.finishModuleLoad();
107
+ });
108
+ };
109
+ runtime.onPause = (info) => {
110
+ this.handleRuntimePause(runtime, info);
111
+ };
112
+ this.disposeLoadedModule();
113
+ this.runtime?.dispose();
114
+ this.runtime = runtime;
115
+ await runtime.launch({
116
+ wasmFilePath: path.resolve(args.program),
117
+ entryFunctionName: args.entryFunctionName ?? "main",
118
+ args: args.args ?? [],
119
+ });
120
+ this.log(`[${runtime.name}] Runtime launched`);
121
+ }
122
+ this.sendResponse(response);
123
+ }
124
+ catch (error) {
125
+ const message = error instanceof Error ? error.message : String(error);
126
+ this.sendErrorResponse(response, 1, `Launch failed: ${message}`);
127
+ }
50
128
  }
51
129
  threadsRequest(response) {
52
130
  response.body = {
@@ -54,18 +132,102 @@ export class WarpoDebugSession extends LoggingDebugSession {
54
132
  };
55
133
  this.sendResponse(response);
56
134
  }
135
+ continueRequest(response, _args) {
136
+ void this.doContinueRequest(response);
137
+ }
57
138
  disconnectRequest(response, _args) {
139
+ this.disposeLoadedModule();
140
+ this.pendingBreakpointUpdatesBySource.clear();
141
+ this.runtime?.dispose();
142
+ this.runtime = undefined;
58
143
  this.log("Debug session ended.");
59
144
  this.sendResponse(response);
60
145
  }
146
+ async doContinueRequest(response) {
147
+ if (!this.runtime) {
148
+ this.sendErrorResponse(response, 1, "No active runtime");
149
+ return;
150
+ }
151
+ try {
152
+ await this.runtime.resume();
153
+ response.body = { allThreadsContinued: true };
154
+ this.sendResponse(response);
155
+ this.sendEvent(new ContinuedEvent(WarpoDebugSession.threadId, true));
156
+ }
157
+ catch (error) {
158
+ const message = error instanceof Error ? error.message : String(error);
159
+ this.sendErrorResponse(response, 1, `Continue failed: ${message}`);
160
+ }
161
+ }
61
162
  logAllBreakpoints() {
62
163
  this.log("=== Registered Breakpoints ===");
63
- for (const [source, bps] of this.breakpoints) {
164
+ for (const [source, bps] of this.requestedBreakpointsBySource) {
64
165
  for (const bp of bps) {
65
166
  this.log(` ${path.basename(source)}:${bp.line} (id=${bp.id}, verified=${bp.verified})`);
66
167
  }
67
168
  }
68
169
  this.log("==============================");
69
170
  }
171
+ requestBreakpointUpdate() {
172
+ if (!this.runtime || !this.loadedModule || this.pendingBreakpointUpdatesBySource.size === 0) {
173
+ return;
174
+ }
175
+ if (this.runtime.isPaused()) {
176
+ this.applyPendingBreakpointUpdates(this.runtime);
177
+ return;
178
+ }
179
+ for (const sourcePath of this.pendingBreakpointUpdatesBySource.keys()) {
180
+ if (this.loadedModule.hasSource(sourcePath)) {
181
+ this.runtime.pause();
182
+ return;
183
+ }
184
+ }
185
+ }
186
+ applyPendingBreakpointUpdates(runtime, onComplete) {
187
+ const module = this.loadedModule;
188
+ if (!module) {
189
+ onComplete?.();
190
+ return;
191
+ }
192
+ for (const [sourcePath, breakpoints] of this.pendingBreakpointUpdatesBySource) {
193
+ if (breakpoints.length === 0) {
194
+ this.pendingBreakpointUpdatesBySource.delete(sourcePath);
195
+ continue;
196
+ }
197
+ if (!module.hasSource(sourcePath)) {
198
+ continue;
199
+ }
200
+ const breakpoint = breakpoints.shift();
201
+ if (!breakpoint) {
202
+ this.pendingBreakpointUpdatesBySource.delete(sourcePath);
203
+ continue;
204
+ }
205
+ if (breakpoints.length === 0) {
206
+ this.pendingBreakpointUpdatesBySource.delete(sourcePath);
207
+ }
208
+ const bytecodeOffset = module.findBytecodeOffset(breakpoint.source, breakpoint.line);
209
+ if (bytecodeOffset === undefined) {
210
+ this.log(`No source-map match for breakpoint ${path.basename(breakpoint.source)}:${breakpoint.line}`);
211
+ this.applyPendingBreakpointUpdates(runtime, onComplete);
212
+ return;
213
+ }
214
+ this.log(`Resolved breakpoint ${path.basename(breakpoint.source)}:${breakpoint.line} -> bytecode offset ${bytecodeOffset}`);
215
+ runtime.setWasmBreakpoint(module, bytecodeOffset, {
216
+ onSuccess: () => {
217
+ this.applyPendingBreakpointUpdates(runtime, onComplete);
218
+ },
219
+ onError: (error) => {
220
+ this.log(`Failed to set breakpoint ${path.basename(breakpoint.source)}:${breakpoint.line}: ${error.message}`);
221
+ this.applyPendingBreakpointUpdates(runtime, onComplete);
222
+ },
223
+ });
224
+ return;
225
+ }
226
+ onComplete?.();
227
+ }
228
+ disposeLoadedModule() {
229
+ this.loadedModule?.dispose();
230
+ this.loadedModule = undefined;
231
+ }
70
232
  }
71
233
  //# sourceMappingURL=debugSession.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debugSession.js","sourceR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AC"}
@@ -0,0 +1,25 @@
1
+ import type { DebuggerWasmModule } from "./debuggerWasmModule.js";
2
+ export interface DebuggerCommandCallbacks {
3
+ onSuccess?: () => void;
4
+ onError?: (error: Error) => void;
5
+ }
6
+ export interface WasmLaunchConfig {
7
+ wasmFilePath: string;
8
+ entryFunctionName: string;
9
+ args: number[];
10
+ }
11
+ export interface DebugPauseInfo {
12
+ reason: string;
13
+ }
14
+ export interface Debugger {
15
+ readonly name: string;
16
+ launch(config: WasmLaunchConfig): Promise<void>;
17
+ dispose(): void;
18
+ isPaused(): boolean;
19
+ pause(): void;
20
+ resume(): Promise<void>;
21
+ finishModuleLoad(): void;
22
+ setWasmBreakpoint(module: DebuggerWasmModule, bytecodeOffset: number, callbacks?: DebuggerCommandCallbacks): void;
23
+ onModuleLoad: ((module: DebuggerWasmModule) => void | Promise<void>) | undefined;
24
+ onPause: ((info: DebugPauseInfo) => void | Promise<void>) | undefined;
25
+ }
@@ -0,0 +1,4 @@
1
+ // Copyright (C) 2025 wasm-ecosystem
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
4
+ //# sourceMappingURL=debugger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugger.js","sourceRoot":"","sources":["../../tools/debug_server/debugger.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC"}
@@ -0,0 +1,28 @@
1
+ import { type BasicSourceMapConsumer, type IndexedSourceMapConsumer } from "source-map";
2
+ export type ParsedSourceMap = BasicSourceMapConsumer | IndexedSourceMapConsumer;
3
+ export interface DebuggerBreakpointInfo {
4
+ id: number;
5
+ line: number;
6
+ verified: boolean;
7
+ source: string;
8
+ }
9
+ export declare class DebuggerWasmModule {
10
+ readonly scriptId: string;
11
+ readonly url: string;
12
+ readonly wasmFilePath: string;
13
+ readonly sourceMapFilePath: string;
14
+ readonly bytecode: Uint8Array;
15
+ readonly sourceMap: ParsedSourceMap;
16
+ private readonly sourcesByPath;
17
+ private constructor();
18
+ static load(wasmFilePath: string, runtimeInfo?: {
19
+ scriptId?: string;
20
+ url?: string;
21
+ }): Promise<DebuggerWasmModule>;
22
+ dispose(): void;
23
+ findBytecodeOffset(sourcePath: string, line: number): number | undefined;
24
+ hasSource(sourcePath: string): boolean;
25
+ private findSource;
26
+ private static loadSourceMap;
27
+ private static resolveSourcePath;
28
+ }
@@ -0,0 +1,75 @@
1
+ // Copyright (C) 2025 wasm-ecosystem
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { readFile } from "node:fs/promises";
4
+ import * as path from "node:path";
5
+ import { SourceMapConsumer, } from "source-map";
6
+ export class DebuggerWasmModule {
7
+ scriptId;
8
+ url;
9
+ wasmFilePath;
10
+ sourceMapFilePath;
11
+ bytecode;
12
+ sourceMap;
13
+ sourcesByPath;
14
+ constructor(scriptId, url, wasmFilePath, sourceMapFilePath, bytecode, sourceMap, sourcesByPath) {
15
+ this.scriptId = scriptId;
16
+ this.url = url;
17
+ this.wasmFilePath = wasmFilePath;
18
+ this.sourceMapFilePath = sourceMapFilePath;
19
+ this.bytecode = bytecode;
20
+ this.sourceMap = sourceMap;
21
+ this.sourcesByPath = sourcesByPath;
22
+ }
23
+ static async load(wasmFilePath, runtimeInfo) {
24
+ const sourceMapFilePath = `${wasmFilePath}.map`;
25
+ const [bytecode, sourceMap] = await Promise.all([
26
+ readFile(wasmFilePath),
27
+ DebuggerWasmModule.loadSourceMap(sourceMapFilePath),
28
+ ]);
29
+ const sourcesByPath = new Map(sourceMap.sources.map((source) => [DebuggerWasmModule.resolveSourcePath(sourceMapFilePath, source), source]));
30
+ return new DebuggerWasmModule(runtimeInfo?.scriptId ?? "", runtimeInfo?.url ?? "", wasmFilePath, sourceMapFilePath, bytecode, sourceMap, sourcesByPath);
31
+ }
32
+ dispose() {
33
+ this.sourceMap.destroy();
34
+ }
35
+ findBytecodeOffset(sourcePath, line) {
36
+ const source = this.findSource(sourcePath);
37
+ if (!source) {
38
+ return undefined;
39
+ }
40
+ const generatedPositions = this.sourceMap.allGeneratedPositionsFor({ source, line });
41
+ let firstOffset;
42
+ for (const generatedPosition of generatedPositions) {
43
+ if (generatedPosition.line === null || generatedPosition.column === null) {
44
+ continue;
45
+ }
46
+ if (firstOffset === undefined || generatedPosition.column < firstOffset) {
47
+ firstOffset = generatedPosition.column;
48
+ }
49
+ }
50
+ return firstOffset;
51
+ }
52
+ hasSource(sourcePath) {
53
+ return this.findSource(sourcePath) !== undefined;
54
+ }
55
+ findSource(sourcePath) {
56
+ const directSource = this.sourcesByPath.get(sourcePath);
57
+ if (directSource) {
58
+ return directSource;
59
+ }
60
+ for (const source of this.sourceMap.sources) {
61
+ if (sourcePath === source || sourcePath.endsWith(`/${source}`)) {
62
+ return source;
63
+ }
64
+ }
65
+ return undefined;
66
+ }
67
+ static async loadSourceMap(sourceMapFilePath) {
68
+ const rawSourceMap = JSON.parse(await readFile(sourceMapFilePath, "utf8"));
69
+ return new SourceMapConsumer(rawSourceMap);
70
+ }
71
+ static resolveSourcePath(sourceMapFilePath, sourcePath) {
72
+ return path.resolve(path.dirname(sourceMapFilePath), sourcePath).replaceAll("\\", "/");
73
+ }
74
+ }
75
+ //# sourceMappingURL=debuggerWasmModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debuggerWasmModule.js","sourceRoot":"","sources":["../../tools/debug_server/debuggerWasmModule.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,iBAAiB,GAKlB,MAAM,YAAY,CAAC;AAuBpB,MAAM,OAAO,kBAAkB;IAIlB;IACA;IACA;IACA;IACA;IACA;IARM,aAAa,CAA8B;IAE5D,YACW,QAAgB,EAChB,GAAW,EACX,YAAoB,EACpB,iBAAyB,EACzB,QAAoB,EACpB,SAA0B,EACnC,aAA0C;QANjC,aAAQ,GAAR,QAAQ,CAAQ;QACh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,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACzF,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ import type { DebugPauseInfo, Debugger, DebuggerCommandCallbacks, WasmLaunchConfig } from "./debugger.js";
2
+ import { DebuggerWasmModule } from "./debuggerWasmModule.js";
3
+ export declare class NodeDebugger implements Debugger {
4
+ readonly name = "node";
5
+ onModuleLoad: ((module: DebuggerWasmModule) => void | Promise<void>) | undefined;
6
+ onPause: ((info: DebugPauseInfo) => void | Promise<void>) | undefined;
7
+ private child;
8
+ private ws;
9
+ private cdpId;
10
+ private readonly pendingCommandCallbacks;
11
+ private paused;
12
+ private wasmFilePath;
13
+ launch(config: WasmLaunchConfig): Promise<void>;
14
+ dispose(): void;
15
+ isPaused(): boolean;
16
+ pause(): void;
17
+ resume(): Promise<void>;
18
+ finishModuleLoad(): void;
19
+ setWasmBreakpoint(module: DebuggerWasmModule, bytecodeOffset: number, callbacks?: DebuggerCommandCallbacks): void;
20
+ private fetchWsUrl;
21
+ private sendCommand;
22
+ private waitForCommand;
23
+ private connectCDP;
24
+ private handleCommandResponse;
25
+ private getPauseReason;
26
+ private handleModuleLoad;
27
+ }