@ton/sandbox 0.21.0-debugger.3 → 0.22.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/CHANGELOG.md +16 -0
- package/dist/blockchain/Blockchain.d.ts +6 -4
- package/dist/blockchain/Blockchain.js +5 -5
- package/dist/blockchain/SmartContract.d.ts +2 -2
- package/dist/blockchain/SmartContract.js +16 -52
- package/dist/executor/Executor.d.ts +0 -29
- package/dist/executor/Executor.js +1 -160
- package/dist/executor/emulator-emscripten.js +1 -1
- package/dist/executor/emulator-emscripten.wasm.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -3
- package/package.json +7 -13
- package/dist/debugger/DebugInfoCache.d.ts +0 -5
- package/dist/debugger/DebugInfoCache.js +0 -49
- package/dist/debugger/Debuggee.d.ts +0 -108
- package/dist/debugger/Debuggee.js +0 -354
- package/dist/debugger/TVMDebugSession.d.ts +0 -26
- package/dist/debugger/TVMDebugSession.js +0 -267
- package/dist/debugger/debug.d.ts +0 -5
- package/dist/debugger/debug.js +0 -64
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TVMDebugSession = void 0;
|
|
4
|
-
const debugadapter_1 = require("@vscode/debugadapter");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
class TVMDebugSession extends debugadapter_1.LoggingDebugSession {
|
|
7
|
-
constructor(debuggee) {
|
|
8
|
-
super();
|
|
9
|
-
this.debuggee = debuggee;
|
|
10
|
-
this.debuggee.on('stopOnEntry', () => {
|
|
11
|
-
this.sendEvent(new debugadapter_1.StoppedEvent('entry', TVMDebugSession.threadID));
|
|
12
|
-
});
|
|
13
|
-
this.debuggee.on('stopOnBreakpoint', () => {
|
|
14
|
-
this.sendEvent(new debugadapter_1.StoppedEvent('breakpoint', TVMDebugSession.threadID));
|
|
15
|
-
});
|
|
16
|
-
this.debuggee.on('stopOnStep', () => {
|
|
17
|
-
this.sendEvent(new debugadapter_1.StoppedEvent('step', TVMDebugSession.threadID));
|
|
18
|
-
});
|
|
19
|
-
this.debuggee.on('end', () => {
|
|
20
|
-
this.sendEvent(new debugadapter_1.TerminatedEvent());
|
|
21
|
-
});
|
|
22
|
-
this.debuggee.on('output', (s) => {
|
|
23
|
-
this.sendEvent(new debugadapter_1.OutputEvent(s + '\n', 'stdout'));
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
initializeRequest(response, args) {
|
|
27
|
-
response.body = response.body || {};
|
|
28
|
-
const b = response.body;
|
|
29
|
-
b.supportsConfigurationDoneRequest = false;
|
|
30
|
-
b.supportsFunctionBreakpoints = false;
|
|
31
|
-
b.supportsConditionalBreakpoints = false;
|
|
32
|
-
b.supportsHitConditionalBreakpoints = false;
|
|
33
|
-
b.supportsEvaluateForHovers = false;
|
|
34
|
-
b.supportsStepBack = false;
|
|
35
|
-
b.supportsSetVariable = false;
|
|
36
|
-
b.supportsRestartFrame = false;
|
|
37
|
-
b.supportsGotoTargetsRequest = false;
|
|
38
|
-
b.supportsStepInTargetsRequest = false;
|
|
39
|
-
b.supportsCompletionsRequest = false;
|
|
40
|
-
b.supportsModulesRequest = false;
|
|
41
|
-
b.supportsRestartRequest = false;
|
|
42
|
-
b.supportsValueFormattingOptions = false;
|
|
43
|
-
b.supportsExceptionInfoRequest = false;
|
|
44
|
-
b.supportTerminateDebuggee = false;
|
|
45
|
-
b.supportSuspendDebuggee = false;
|
|
46
|
-
b.supportsDelayedStackTraceLoading = false;
|
|
47
|
-
b.supportsLoadedSourcesRequest = true;
|
|
48
|
-
b.supportsLogPoints = false;
|
|
49
|
-
b.supportsTerminateThreadsRequest = false;
|
|
50
|
-
b.supportsSetExpression = false;
|
|
51
|
-
b.supportsTerminateRequest = false;
|
|
52
|
-
b.supportsDataBreakpoints = false;
|
|
53
|
-
b.supportsReadMemoryRequest = false;
|
|
54
|
-
b.supportsWriteMemoryRequest = false;
|
|
55
|
-
b.supportsDisassembleRequest = false;
|
|
56
|
-
b.supportsCancelRequest = false;
|
|
57
|
-
b.supportsBreakpointLocationsRequest = true;
|
|
58
|
-
b.supportsClipboardContext = false;
|
|
59
|
-
b.supportsSteppingGranularity = false;
|
|
60
|
-
b.supportsInstructionBreakpoints = false;
|
|
61
|
-
b.supportsExceptionFilterOptions = false;
|
|
62
|
-
b.supportsSingleThreadExecutionRequests = false;
|
|
63
|
-
this.sendResponse(response);
|
|
64
|
-
this.sendEvent(new debugadapter_1.InitializedEvent());
|
|
65
|
-
}
|
|
66
|
-
loadedSourcesRequest(response, args, request) {
|
|
67
|
-
response.body = response.body || {};
|
|
68
|
-
response.body.sources = this.debuggee.getAvailableSourcePaths().map(v => ({
|
|
69
|
-
path: v,
|
|
70
|
-
name: (0, node_path_1.basename)(v),
|
|
71
|
-
}));
|
|
72
|
-
this.sendResponse(response);
|
|
73
|
-
}
|
|
74
|
-
breakpointLocationsRequest(response, args, request) {
|
|
75
|
-
response.body = response.body || {};
|
|
76
|
-
const path = args.source.path;
|
|
77
|
-
if (path === undefined) {
|
|
78
|
-
this.sendErrorResponse(response, {
|
|
79
|
-
id: 1001,
|
|
80
|
-
format: 'No path',
|
|
81
|
-
});
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
response.body.breakpoints = this.debuggee.getAvailableLines(path).filter(l => l >= args.line && l <= (args.endLine ?? args.line)).map(l => ({
|
|
85
|
-
line: l,
|
|
86
|
-
}));
|
|
87
|
-
this.sendResponse(response);
|
|
88
|
-
}
|
|
89
|
-
launchRequest(response, args, request) {
|
|
90
|
-
debugadapter_1.logger.setup(debugadapter_1.Logger.LogLevel.Log);
|
|
91
|
-
this.debuggee.start(!args.noDebug, true);
|
|
92
|
-
this.sendResponse(response);
|
|
93
|
-
}
|
|
94
|
-
attachRequest(response, args, request) {
|
|
95
|
-
this.launchRequest(response, args, request);
|
|
96
|
-
}
|
|
97
|
-
setBreakPointsRequest(response, args, request) {
|
|
98
|
-
const path = args.source.path;
|
|
99
|
-
if (path === undefined) {
|
|
100
|
-
this.sendErrorResponse(response, {
|
|
101
|
-
id: 1001,
|
|
102
|
-
format: 'No path',
|
|
103
|
-
});
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const breakpoints = args.breakpoints;
|
|
107
|
-
if (breakpoints === undefined) {
|
|
108
|
-
this.sendErrorResponse(response, {
|
|
109
|
-
id: 1002,
|
|
110
|
-
format: 'No breakpoints',
|
|
111
|
-
});
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
this.debuggee.clearBreakpoints(path);
|
|
115
|
-
const bps = [];
|
|
116
|
-
for (const bp of breakpoints) {
|
|
117
|
-
const sbp = this.debuggee.setBreakpoint(path, bp.line);
|
|
118
|
-
bps.push({
|
|
119
|
-
id: sbp.id,
|
|
120
|
-
line: sbp.line,
|
|
121
|
-
verified: sbp.verified,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
response.body = {
|
|
125
|
-
breakpoints: bps,
|
|
126
|
-
};
|
|
127
|
-
this.sendResponse(response);
|
|
128
|
-
}
|
|
129
|
-
threadsRequest(response, request) {
|
|
130
|
-
response.body = {
|
|
131
|
-
threads: [
|
|
132
|
-
new debugadapter_1.Thread(TVMDebugSession.threadID, 'main'),
|
|
133
|
-
],
|
|
134
|
-
};
|
|
135
|
-
this.sendResponse(response);
|
|
136
|
-
}
|
|
137
|
-
continueRequest(response, args, request) {
|
|
138
|
-
this.debuggee.continue();
|
|
139
|
-
this.sendResponse(response);
|
|
140
|
-
}
|
|
141
|
-
nextRequest(response, args, request) {
|
|
142
|
-
this.debuggee.stepOver();
|
|
143
|
-
this.sendResponse(response);
|
|
144
|
-
}
|
|
145
|
-
stepInRequest(response, args, request) {
|
|
146
|
-
this.debuggee.stepIn();
|
|
147
|
-
this.sendResponse(response);
|
|
148
|
-
}
|
|
149
|
-
stepOutRequest(response, args, request) {
|
|
150
|
-
this.debuggee.stepOut();
|
|
151
|
-
this.sendResponse(response);
|
|
152
|
-
}
|
|
153
|
-
stackTraceRequest(response, args, request) {
|
|
154
|
-
response.body = response.body || {};
|
|
155
|
-
const sme = this.debuggee.currentSourceMapEntry();
|
|
156
|
-
if (sme === undefined) {
|
|
157
|
-
response.body.stackFrames = [];
|
|
158
|
-
response.body.totalFrames = 0;
|
|
159
|
-
this.sendResponse(response);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const frames = this.debuggee.stackFrames();
|
|
163
|
-
response.body.totalFrames = frames.length;
|
|
164
|
-
if (args.startFrame ?? 0 >= frames.length) {
|
|
165
|
-
response.body.stackFrames = [];
|
|
166
|
-
this.sendResponse(response);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
response.body.stackFrames = [];
|
|
170
|
-
for (let i = args.startFrame ?? 0; i < frames.length; i++) {
|
|
171
|
-
const frame = frames[i];
|
|
172
|
-
response.body.stackFrames.push({
|
|
173
|
-
id: i === frames.length - 1 ? TVMDebugSession.stackFrameID : 0,
|
|
174
|
-
name: frame.function,
|
|
175
|
-
line: frame.line,
|
|
176
|
-
column: 0,
|
|
177
|
-
source: {
|
|
178
|
-
name: (0, node_path_1.basename)(frame.path),
|
|
179
|
-
path: frame.path,
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
response.body.stackFrames.reverse();
|
|
184
|
-
this.sendResponse(response);
|
|
185
|
-
}
|
|
186
|
-
scopesRequest(response, args, request) {
|
|
187
|
-
response.body = response.body || {};
|
|
188
|
-
if (args.frameId !== TVMDebugSession.stackFrameID) {
|
|
189
|
-
response.body.scopes = [];
|
|
190
|
-
this.sendResponse(response);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
const sme = this.debuggee.currentSourceMapEntry();
|
|
194
|
-
if (sme === undefined) {
|
|
195
|
-
response.body.scopes = [];
|
|
196
|
-
this.sendResponse(response);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
response.body.scopes = [{
|
|
200
|
-
name: 'Locals',
|
|
201
|
-
variablesReference: TVMDebugSession.localVariablesReference,
|
|
202
|
-
expensive: false,
|
|
203
|
-
}, {
|
|
204
|
-
name: 'Globals',
|
|
205
|
-
variablesReference: TVMDebugSession.globalVariablesReference,
|
|
206
|
-
expensive: false,
|
|
207
|
-
}];
|
|
208
|
-
this.sendResponse(response);
|
|
209
|
-
}
|
|
210
|
-
variablesRequest(response, args, request) {
|
|
211
|
-
response.body = response.body || {};
|
|
212
|
-
response.body.variables = [];
|
|
213
|
-
let vars = undefined;
|
|
214
|
-
if (args.variablesReference === TVMDebugSession.localVariablesReference) {
|
|
215
|
-
vars = this.debuggee.getLocalVariables();
|
|
216
|
-
}
|
|
217
|
-
else if (args.variablesReference === TVMDebugSession.globalVariablesReference) {
|
|
218
|
-
vars = this.debuggee.getGlobalVariables();
|
|
219
|
-
}
|
|
220
|
-
if (vars === undefined) {
|
|
221
|
-
this.sendResponse(response);
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
for (const v of vars) {
|
|
225
|
-
response.body.variables.push({
|
|
226
|
-
name: v.name,
|
|
227
|
-
value: tupleItemToString(v.value),
|
|
228
|
-
type: v.value.type,
|
|
229
|
-
variablesReference: 0,
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
response.body.variables.sort((a, b) => (a.name < b.name) ? -1 : (a.name > b.name ? 1 : 0));
|
|
233
|
-
this.sendResponse(response);
|
|
234
|
-
}
|
|
235
|
-
disconnectRequest(response, args, request) {
|
|
236
|
-
if (args.restart) {
|
|
237
|
-
this.sendErrorResponse(response, {
|
|
238
|
-
id: 1003,
|
|
239
|
-
format: 'Cannot restart',
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
this.sendResponse(response);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
exports.TVMDebugSession = TVMDebugSession;
|
|
248
|
-
TVMDebugSession.threadID = 1;
|
|
249
|
-
TVMDebugSession.stackFrameID = 1;
|
|
250
|
-
TVMDebugSession.localVariablesReference = 1;
|
|
251
|
-
TVMDebugSession.globalVariablesReference = 2;
|
|
252
|
-
function tupleItemToString(ti) {
|
|
253
|
-
switch (ti.type) {
|
|
254
|
-
case 'int':
|
|
255
|
-
return ti.value.toString();
|
|
256
|
-
case 'null':
|
|
257
|
-
return 'null';
|
|
258
|
-
case 'nan':
|
|
259
|
-
return 'NaN';
|
|
260
|
-
case 'cell':
|
|
261
|
-
case 'slice':
|
|
262
|
-
case 'builder':
|
|
263
|
-
return ti.cell.toBoc().toString('base64');
|
|
264
|
-
case 'tuple':
|
|
265
|
-
return `[${ti.items.map(v => tupleItemToString(v)).join(', ')}]`;
|
|
266
|
-
}
|
|
267
|
-
}
|
package/dist/debugger/debug.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Cell } from '@ton/core';
|
|
2
|
-
import { GetMethodArgs, Executor, GetMethodResult, RunTransactionArgs, EmulationResult } from '../executor/Executor';
|
|
3
|
-
import { DebugInfo } from "./Debuggee";
|
|
4
|
-
export declare function debugGetMethod(executor: Executor, args: GetMethodArgs, debugInfo: DebugInfo): Promise<GetMethodResult>;
|
|
5
|
-
export declare function debugTransaction(executor: Executor, args: RunTransactionArgs, code: Cell, debugInfo: DebugInfo): Promise<EmulationResult>;
|
package/dist/debugger/debug.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.debugTransaction = exports.debugGetMethod = void 0;
|
|
27
|
-
const Debuggee_1 = require("./Debuggee");
|
|
28
|
-
const Net = __importStar(require("net"));
|
|
29
|
-
const TVMDebugSession_1 = require("./TVMDebugSession");
|
|
30
|
-
function initDebuggee(executor) {
|
|
31
|
-
let dbg = null;
|
|
32
|
-
const promise = new Promise((resolve) => {
|
|
33
|
-
dbg = new Debuggee_1.Debuggee(executor, resolve);
|
|
34
|
-
});
|
|
35
|
-
return { dbg, promise };
|
|
36
|
-
}
|
|
37
|
-
async function debugGetMethod(executor, args, debugInfo) {
|
|
38
|
-
console.log('Launched get method debug session. Please connect using the extension.');
|
|
39
|
-
const { dbg, promise } = initDebuggee(executor);
|
|
40
|
-
dbg.prepareGetMethod(args, debugInfo);
|
|
41
|
-
const server = Net.createServer((socket) => {
|
|
42
|
-
const session = new TVMDebugSession_1.TVMDebugSession(dbg);
|
|
43
|
-
session.setRunAsServer(true);
|
|
44
|
-
session.start(socket, socket);
|
|
45
|
-
}).listen(42069);
|
|
46
|
-
const result = await promise;
|
|
47
|
-
server.close();
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
exports.debugGetMethod = debugGetMethod;
|
|
51
|
-
async function debugTransaction(executor, args, code, debugInfo) {
|
|
52
|
-
console.log('Launched transaction debug session. Please connect using the extension.');
|
|
53
|
-
const { dbg, promise } = initDebuggee(executor);
|
|
54
|
-
dbg.prepareTransaction(args, code, debugInfo);
|
|
55
|
-
const server = Net.createServer((socket) => {
|
|
56
|
-
const session = new TVMDebugSession_1.TVMDebugSession(dbg);
|
|
57
|
-
session.setRunAsServer(true);
|
|
58
|
-
session.start(socket, socket);
|
|
59
|
-
}).listen(42069);
|
|
60
|
-
const result = await promise;
|
|
61
|
-
server.close();
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
exports.debugTransaction = debugTransaction;
|