@codingame/monaco-vscode-debug-service-override 1.85.0 → 1.85.2
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/debug.js +4 -1
- package/package.json +3 -3
- package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +73 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +141 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +1 -1
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +9 -9
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +0 -857
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +0 -412
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +0 -1593
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +0 -180
- package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +0 -1487
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +0 -127
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +0 -31
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +0 -207
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +0 -13
|
@@ -1,1487 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { distinct } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
3
|
-
import { DeferredPromise, RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
4
|
-
import { decodeBase64, VSBuffer, encodeBase64 } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
5
|
-
import { CancellationTokenSource } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
6
|
-
import { stringHash } from 'monaco-editor/esm/vs/base/common/hash.js';
|
|
7
|
-
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
8
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
9
|
-
import { mixin } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
10
|
-
import * as resources from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
11
|
-
import { isString, isUndefinedOrNull } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
12
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
13
|
-
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
14
|
-
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
15
|
-
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
16
|
-
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
17
|
-
import { DEBUG_MEMORY_SCHEME } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
18
|
-
import { getUriFromSource, UNKNOWN_SOURCE_LABEL } from './debugSource.js';
|
|
19
|
-
import { DisassemblyViewInput } from './disassemblyViewInput.js';
|
|
20
|
-
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
21
|
-
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
22
|
-
import { autorun } from 'monaco-editor/esm/vs/base/common/observable.js';
|
|
23
|
-
import { findLastIdx } from 'monaco-editor/esm/vs/base/common/arraysFind.js';
|
|
24
|
-
|
|
25
|
-
class ExpressionContainer {
|
|
26
|
-
static { this.allValues = ( new Map()); }
|
|
27
|
-
static { this.BASE_CHUNK_SIZE = 100; }
|
|
28
|
-
constructor(session, threadId, _reference, id, namedVariables = 0, indexedVariables = 0, memoryReference = undefined, startOfVariables = 0, presentationHint = undefined) {
|
|
29
|
-
this.session = session;
|
|
30
|
-
this.threadId = threadId;
|
|
31
|
-
this._reference = _reference;
|
|
32
|
-
this.id = id;
|
|
33
|
-
this.namedVariables = namedVariables;
|
|
34
|
-
this.indexedVariables = indexedVariables;
|
|
35
|
-
this.memoryReference = memoryReference;
|
|
36
|
-
this.startOfVariables = startOfVariables;
|
|
37
|
-
this.presentationHint = presentationHint;
|
|
38
|
-
this.valueChanged = false;
|
|
39
|
-
this._value = '';
|
|
40
|
-
}
|
|
41
|
-
get reference() {
|
|
42
|
-
return this._reference;
|
|
43
|
-
}
|
|
44
|
-
set reference(value) {
|
|
45
|
-
this._reference = value;
|
|
46
|
-
this.children = undefined;
|
|
47
|
-
}
|
|
48
|
-
async evaluateLazy() {
|
|
49
|
-
if (typeof this.reference === 'undefined') {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const response = await this.session.variables(this.reference, this.threadId, undefined, undefined, undefined);
|
|
53
|
-
if (!response || !response.body || !response.body.variables || response.body.variables.length !== 1) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const dummyVar = response.body.variables[0];
|
|
57
|
-
this.reference = dummyVar.variablesReference;
|
|
58
|
-
this._value = dummyVar.value;
|
|
59
|
-
this.namedVariables = dummyVar.namedVariables;
|
|
60
|
-
this.indexedVariables = dummyVar.indexedVariables;
|
|
61
|
-
this.memoryReference = dummyVar.memoryReference;
|
|
62
|
-
this.presentationHint = dummyVar.presentationHint;
|
|
63
|
-
this.adoptLazyResponse(dummyVar);
|
|
64
|
-
}
|
|
65
|
-
adoptLazyResponse(response) {
|
|
66
|
-
}
|
|
67
|
-
getChildren() {
|
|
68
|
-
if (!this.children) {
|
|
69
|
-
this.children = this.doGetChildren();
|
|
70
|
-
}
|
|
71
|
-
return this.children;
|
|
72
|
-
}
|
|
73
|
-
async doGetChildren() {
|
|
74
|
-
if (!this.hasChildren) {
|
|
75
|
-
return [];
|
|
76
|
-
}
|
|
77
|
-
if (!this.getChildrenInChunks) {
|
|
78
|
-
return this.fetchVariables(undefined, undefined, undefined);
|
|
79
|
-
}
|
|
80
|
-
const children = this.namedVariables ? await this.fetchVariables(undefined, undefined, 'named') : [];
|
|
81
|
-
let chunkSize = ExpressionContainer.BASE_CHUNK_SIZE;
|
|
82
|
-
while (!!this.indexedVariables && this.indexedVariables > chunkSize * ExpressionContainer.BASE_CHUNK_SIZE) {
|
|
83
|
-
chunkSize *= ExpressionContainer.BASE_CHUNK_SIZE;
|
|
84
|
-
}
|
|
85
|
-
if (!!this.indexedVariables && this.indexedVariables > chunkSize) {
|
|
86
|
-
const numberOfChunks = Math.ceil(this.indexedVariables / chunkSize);
|
|
87
|
-
for (let i = 0; i < numberOfChunks; i++) {
|
|
88
|
-
const start = (this.startOfVariables || 0) + i * chunkSize;
|
|
89
|
-
const count = Math.min(chunkSize, this.indexedVariables - i * chunkSize);
|
|
90
|
-
children.push(( new Variable(
|
|
91
|
-
this.session,
|
|
92
|
-
this.threadId,
|
|
93
|
-
this,
|
|
94
|
-
this.reference,
|
|
95
|
-
`[${start}..${start + count - 1}]`,
|
|
96
|
-
'',
|
|
97
|
-
'',
|
|
98
|
-
undefined,
|
|
99
|
-
count,
|
|
100
|
-
undefined,
|
|
101
|
-
{ kind: 'virtual' },
|
|
102
|
-
undefined,
|
|
103
|
-
undefined,
|
|
104
|
-
true,
|
|
105
|
-
start
|
|
106
|
-
)));
|
|
107
|
-
}
|
|
108
|
-
return children;
|
|
109
|
-
}
|
|
110
|
-
const variables = await this.fetchVariables(this.startOfVariables, this.indexedVariables, 'indexed');
|
|
111
|
-
return children.concat(variables);
|
|
112
|
-
}
|
|
113
|
-
getId() {
|
|
114
|
-
return this.id;
|
|
115
|
-
}
|
|
116
|
-
getSession() {
|
|
117
|
-
return this.session;
|
|
118
|
-
}
|
|
119
|
-
get value() {
|
|
120
|
-
return this._value;
|
|
121
|
-
}
|
|
122
|
-
get hasChildren() {
|
|
123
|
-
return !!this.reference && this.reference > 0 && !this.presentationHint?.lazy;
|
|
124
|
-
}
|
|
125
|
-
async fetchVariables(start, count, filter) {
|
|
126
|
-
try {
|
|
127
|
-
const response = await this.session.variables(this.reference || 0, this.threadId, filter, start, count);
|
|
128
|
-
if (!response || !response.body || !response.body.variables) {
|
|
129
|
-
return [];
|
|
130
|
-
}
|
|
131
|
-
const nameCount = ( new Map());
|
|
132
|
-
const vars = ( response.body.variables.filter(v => !!v).map((v) => {
|
|
133
|
-
if (isString(v.value) && isString(v.name) && typeof v.variablesReference === 'number') {
|
|
134
|
-
const count = nameCount.get(v.name) || 0;
|
|
135
|
-
const idDuplicationIndex = count > 0 ? ( count.toString()) : '';
|
|
136
|
-
nameCount.set(v.name, count + 1);
|
|
137
|
-
return ( new Variable(
|
|
138
|
-
this.session,
|
|
139
|
-
this.threadId,
|
|
140
|
-
this,
|
|
141
|
-
v.variablesReference,
|
|
142
|
-
v.name,
|
|
143
|
-
v.evaluateName,
|
|
144
|
-
v.value,
|
|
145
|
-
v.namedVariables,
|
|
146
|
-
v.indexedVariables,
|
|
147
|
-
v.memoryReference,
|
|
148
|
-
v.presentationHint,
|
|
149
|
-
v.type,
|
|
150
|
-
v.__vscodeVariableMenuContext,
|
|
151
|
-
true,
|
|
152
|
-
0,
|
|
153
|
-
idDuplicationIndex
|
|
154
|
-
));
|
|
155
|
-
}
|
|
156
|
-
return ( new Variable(this.session, this.threadId, this, 0, '', undefined, ( nls.localizeWithPath(
|
|
157
|
-
'vs/workbench/contrib/debug/common/debugModel',
|
|
158
|
-
'invalidVariableAttributes',
|
|
159
|
-
"Invalid variable attributes"
|
|
160
|
-
)), 0, 0, undefined, { kind: 'virtual' }, undefined, undefined, false));
|
|
161
|
-
}));
|
|
162
|
-
if (this.session.autoExpandLazyVariables) {
|
|
163
|
-
await Promise.all(( vars.map(v => v.presentationHint?.lazy && v.evaluateLazy())));
|
|
164
|
-
}
|
|
165
|
-
return vars;
|
|
166
|
-
}
|
|
167
|
-
catch (e) {
|
|
168
|
-
return [( new Variable(
|
|
169
|
-
this.session,
|
|
170
|
-
this.threadId,
|
|
171
|
-
this,
|
|
172
|
-
0,
|
|
173
|
-
'',
|
|
174
|
-
undefined,
|
|
175
|
-
e.message,
|
|
176
|
-
0,
|
|
177
|
-
0,
|
|
178
|
-
undefined,
|
|
179
|
-
{ kind: 'virtual' },
|
|
180
|
-
undefined,
|
|
181
|
-
undefined,
|
|
182
|
-
false
|
|
183
|
-
))];
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
get getChildrenInChunks() {
|
|
187
|
-
return !!this.indexedVariables;
|
|
188
|
-
}
|
|
189
|
-
set value(value) {
|
|
190
|
-
this._value = value;
|
|
191
|
-
this.valueChanged = !!ExpressionContainer.allValues.get(this.getId()) &&
|
|
192
|
-
ExpressionContainer.allValues.get(this.getId()) !== Expression.DEFAULT_VALUE && ExpressionContainer.allValues.get(this.getId()) !== value;
|
|
193
|
-
ExpressionContainer.allValues.set(this.getId(), value);
|
|
194
|
-
}
|
|
195
|
-
toString() {
|
|
196
|
-
return this.value;
|
|
197
|
-
}
|
|
198
|
-
async evaluateExpression(expression, session, stackFrame, context, keepLazyVars = false) {
|
|
199
|
-
if (!session || (!stackFrame && context !== 'repl')) {
|
|
200
|
-
this.value = context === 'repl' ? ( nls.localizeWithPath(
|
|
201
|
-
'vs/workbench/contrib/debug/common/debugModel',
|
|
202
|
-
'startDebugFirst',
|
|
203
|
-
"Please start a debug session to evaluate expressions"
|
|
204
|
-
)) : Expression.DEFAULT_VALUE;
|
|
205
|
-
this.reference = 0;
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
this.session = session;
|
|
209
|
-
try {
|
|
210
|
-
const response = await session.evaluate(expression, stackFrame ? stackFrame.frameId : undefined, context);
|
|
211
|
-
if (response && response.body) {
|
|
212
|
-
this.value = response.body.result || '';
|
|
213
|
-
this.reference = response.body.variablesReference;
|
|
214
|
-
this.namedVariables = response.body.namedVariables;
|
|
215
|
-
this.indexedVariables = response.body.indexedVariables;
|
|
216
|
-
this.memoryReference = response.body.memoryReference;
|
|
217
|
-
this.type = response.body.type || this.type;
|
|
218
|
-
this.presentationHint = response.body.presentationHint;
|
|
219
|
-
if (!keepLazyVars && response.body.presentationHint?.lazy) {
|
|
220
|
-
await this.evaluateLazy();
|
|
221
|
-
}
|
|
222
|
-
return true;
|
|
223
|
-
}
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
catch (e) {
|
|
227
|
-
this.value = e.message || '';
|
|
228
|
-
this.reference = 0;
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
function handleSetResponse(expression, response) {
|
|
234
|
-
if (response && response.body) {
|
|
235
|
-
expression.value = response.body.value || '';
|
|
236
|
-
expression.type = response.body.type || expression.type;
|
|
237
|
-
expression.reference = response.body.variablesReference;
|
|
238
|
-
expression.namedVariables = response.body.namedVariables;
|
|
239
|
-
expression.indexedVariables = response.body.indexedVariables;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
class Expression extends ExpressionContainer {
|
|
243
|
-
static { this.DEFAULT_VALUE = ( nls.localizeWithPath(
|
|
244
|
-
'vs/workbench/contrib/debug/common/debugModel',
|
|
245
|
-
'notAvailable',
|
|
246
|
-
"not available"
|
|
247
|
-
)); }
|
|
248
|
-
constructor(name, id = generateUuid()) {
|
|
249
|
-
super(undefined, undefined, 0, id);
|
|
250
|
-
this.name = name;
|
|
251
|
-
this.available = false;
|
|
252
|
-
if (name) {
|
|
253
|
-
this.value = Expression.DEFAULT_VALUE;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
async evaluate(session, stackFrame, context, keepLazyVars) {
|
|
257
|
-
this.available = await this.evaluateExpression(this.name, session, stackFrame, context, keepLazyVars);
|
|
258
|
-
}
|
|
259
|
-
toString() {
|
|
260
|
-
return `${this.name}\n${this.value}`;
|
|
261
|
-
}
|
|
262
|
-
async setExpression(value, stackFrame) {
|
|
263
|
-
if (!this.session) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
const response = await this.session.setExpression(stackFrame.frameId, this.name, value);
|
|
267
|
-
handleSetResponse(this, response);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
class Variable extends ExpressionContainer {
|
|
271
|
-
constructor(session, threadId, parent, reference, name, evaluateName, value, namedVariables, indexedVariables, memoryReference, presentationHint, type = undefined, variableMenuContext = undefined, available = true, startOfVariables = 0, idDuplicationIndex = '') {
|
|
272
|
-
super(session, threadId, reference, `variable:${parent.getId()}:${name}:${idDuplicationIndex}`, namedVariables, indexedVariables, memoryReference, startOfVariables, presentationHint);
|
|
273
|
-
this.parent = parent;
|
|
274
|
-
this.name = name;
|
|
275
|
-
this.evaluateName = evaluateName;
|
|
276
|
-
this.variableMenuContext = variableMenuContext;
|
|
277
|
-
this.available = available;
|
|
278
|
-
this.value = value || '';
|
|
279
|
-
this.type = type;
|
|
280
|
-
}
|
|
281
|
-
async setVariable(value, stackFrame) {
|
|
282
|
-
if (!this.session) {
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
try {
|
|
286
|
-
if (this.session.capabilities.supportsSetExpression && !this.session.capabilities.supportsSetVariable && this.evaluateName) {
|
|
287
|
-
return this.setExpression(value, stackFrame);
|
|
288
|
-
}
|
|
289
|
-
const response = await this.session.setVariable(this.parent.reference, this.name, value);
|
|
290
|
-
handleSetResponse(this, response);
|
|
291
|
-
}
|
|
292
|
-
catch (err) {
|
|
293
|
-
this.errorMessage = err.message;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
async setExpression(value, stackFrame) {
|
|
297
|
-
if (!this.session || !this.evaluateName) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
const response = await this.session.setExpression(stackFrame.frameId, this.evaluateName, value);
|
|
301
|
-
handleSetResponse(this, response);
|
|
302
|
-
}
|
|
303
|
-
toString() {
|
|
304
|
-
return this.name ? `${this.name}: ${this.value}` : this.value;
|
|
305
|
-
}
|
|
306
|
-
adoptLazyResponse(response) {
|
|
307
|
-
this.evaluateName = response.evaluateName;
|
|
308
|
-
}
|
|
309
|
-
toDebugProtocolObject() {
|
|
310
|
-
return {
|
|
311
|
-
name: this.name,
|
|
312
|
-
variablesReference: this.reference || 0,
|
|
313
|
-
memoryReference: this.memoryReference,
|
|
314
|
-
value: this.value,
|
|
315
|
-
evaluateName: this.evaluateName
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
class Scope extends ExpressionContainer {
|
|
320
|
-
constructor(stackFrame, id, name, reference, expensive, namedVariables, indexedVariables, range) {
|
|
321
|
-
super(stackFrame.thread.session, stackFrame.thread.threadId, reference, `scope:${name}:${id}`, namedVariables, indexedVariables);
|
|
322
|
-
this.name = name;
|
|
323
|
-
this.expensive = expensive;
|
|
324
|
-
this.range = range;
|
|
325
|
-
}
|
|
326
|
-
toString() {
|
|
327
|
-
return this.name;
|
|
328
|
-
}
|
|
329
|
-
toDebugProtocolObject() {
|
|
330
|
-
return {
|
|
331
|
-
name: this.name,
|
|
332
|
-
variablesReference: this.reference || 0,
|
|
333
|
-
expensive: this.expensive
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
class ErrorScope extends Scope {
|
|
338
|
-
constructor(stackFrame, index, message) {
|
|
339
|
-
super(stackFrame, index, message, 0, false);
|
|
340
|
-
}
|
|
341
|
-
toString() {
|
|
342
|
-
return this.name;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
class StackFrame {
|
|
346
|
-
constructor(thread, frameId, source, name, presentationHint, range, index, canRestart, instructionPointerReference) {
|
|
347
|
-
this.thread = thread;
|
|
348
|
-
this.frameId = frameId;
|
|
349
|
-
this.source = source;
|
|
350
|
-
this.name = name;
|
|
351
|
-
this.presentationHint = presentationHint;
|
|
352
|
-
this.range = range;
|
|
353
|
-
this.index = index;
|
|
354
|
-
this.canRestart = canRestart;
|
|
355
|
-
this.instructionPointerReference = instructionPointerReference;
|
|
356
|
-
}
|
|
357
|
-
getId() {
|
|
358
|
-
return `stackframe:${this.thread.getId()}:${this.index}:${this.source.name}`;
|
|
359
|
-
}
|
|
360
|
-
getScopes() {
|
|
361
|
-
if (!this.scopes) {
|
|
362
|
-
this.scopes = this.thread.session.scopes(this.frameId, this.thread.threadId).then(response => {
|
|
363
|
-
if (!response || !response.body || !response.body.scopes) {
|
|
364
|
-
return [];
|
|
365
|
-
}
|
|
366
|
-
const usedIds = ( new Set());
|
|
367
|
-
return ( response.body.scopes.map(rs => {
|
|
368
|
-
let id = 0;
|
|
369
|
-
do {
|
|
370
|
-
id = stringHash(`${rs.name}:${rs.line}:${rs.column}`, id);
|
|
371
|
-
} while (( usedIds.has(id)));
|
|
372
|
-
usedIds.add(id);
|
|
373
|
-
return ( new Scope(
|
|
374
|
-
this,
|
|
375
|
-
id,
|
|
376
|
-
rs.name,
|
|
377
|
-
rs.variablesReference,
|
|
378
|
-
rs.expensive,
|
|
379
|
-
rs.namedVariables,
|
|
380
|
-
rs.indexedVariables,
|
|
381
|
-
rs.line && rs.column && rs.endLine && rs.endColumn ? ( new Range(rs.line, rs.column, rs.endLine, rs.endColumn)) : undefined
|
|
382
|
-
));
|
|
383
|
-
}));
|
|
384
|
-
}, err => [( new ErrorScope(this, 0, err.message))]);
|
|
385
|
-
}
|
|
386
|
-
return this.scopes;
|
|
387
|
-
}
|
|
388
|
-
async getMostSpecificScopes(range) {
|
|
389
|
-
const scopes = await this.getScopes();
|
|
390
|
-
const nonExpensiveScopes = scopes.filter(s => !s.expensive);
|
|
391
|
-
const haveRangeInfo = ( nonExpensiveScopes.some(s => !!s.range));
|
|
392
|
-
if (!haveRangeInfo) {
|
|
393
|
-
return nonExpensiveScopes;
|
|
394
|
-
}
|
|
395
|
-
const scopesContainingRange = nonExpensiveScopes.filter(scope => scope.range && Range.containsRange(scope.range, range))
|
|
396
|
-
.sort((first, second) => (first.range.endLineNumber - first.range.startLineNumber) - (second.range.endLineNumber - second.range.startLineNumber));
|
|
397
|
-
return scopesContainingRange.length ? scopesContainingRange : nonExpensiveScopes;
|
|
398
|
-
}
|
|
399
|
-
restart() {
|
|
400
|
-
return this.thread.session.restartFrame(this.frameId, this.thread.threadId);
|
|
401
|
-
}
|
|
402
|
-
forgetScopes() {
|
|
403
|
-
this.scopes = undefined;
|
|
404
|
-
}
|
|
405
|
-
toString() {
|
|
406
|
-
const lineNumberToString = typeof this.range.startLineNumber === 'number' ? `:${this.range.startLineNumber}` : '';
|
|
407
|
-
const sourceToString = `${this.source.inMemory ? this.source.name : this.source.uri.fsPath}${lineNumberToString}`;
|
|
408
|
-
return sourceToString === UNKNOWN_SOURCE_LABEL ? this.name : `${this.name} (${sourceToString})`;
|
|
409
|
-
}
|
|
410
|
-
async openInEditor(editorService, preserveFocus, sideBySide, pinned) {
|
|
411
|
-
const threadStopReason = this.thread.stoppedDetails?.reason;
|
|
412
|
-
if (this.instructionPointerReference &&
|
|
413
|
-
(threadStopReason === 'instruction breakpoint' ||
|
|
414
|
-
(threadStopReason === 'step' && this.thread.lastSteppingGranularity === 'instruction') ||
|
|
415
|
-
editorService.activeEditor instanceof DisassemblyViewInput)) {
|
|
416
|
-
return editorService.openEditor(DisassemblyViewInput.instance, { pinned: true, revealIfOpened: true });
|
|
417
|
-
}
|
|
418
|
-
if (this.source.available) {
|
|
419
|
-
return this.source.openInEditor(editorService, this.range, preserveFocus, sideBySide, pinned);
|
|
420
|
-
}
|
|
421
|
-
return undefined;
|
|
422
|
-
}
|
|
423
|
-
equals(other) {
|
|
424
|
-
return (this.name === other.name) && (other.thread === this.thread) && (this.frameId === other.frameId) && (other.source === this.source) && (Range.equalsRange(this.range, other.range));
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
class Thread {
|
|
428
|
-
constructor(session, name, threadId) {
|
|
429
|
-
this.session = session;
|
|
430
|
-
this.name = name;
|
|
431
|
-
this.threadId = threadId;
|
|
432
|
-
this.callStackCancellationTokens = [];
|
|
433
|
-
this.reachedEndOfCallStack = false;
|
|
434
|
-
this.callStack = [];
|
|
435
|
-
this.staleCallStack = [];
|
|
436
|
-
this.stopped = false;
|
|
437
|
-
}
|
|
438
|
-
getId() {
|
|
439
|
-
return `thread:${this.session.getId()}:${this.threadId}`;
|
|
440
|
-
}
|
|
441
|
-
clearCallStack() {
|
|
442
|
-
if (this.callStack.length) {
|
|
443
|
-
this.staleCallStack = this.callStack;
|
|
444
|
-
}
|
|
445
|
-
this.callStack = [];
|
|
446
|
-
this.callStackCancellationTokens.forEach(c => c.dispose(true));
|
|
447
|
-
this.callStackCancellationTokens = [];
|
|
448
|
-
}
|
|
449
|
-
getCallStack() {
|
|
450
|
-
return this.callStack;
|
|
451
|
-
}
|
|
452
|
-
getStaleCallStack() {
|
|
453
|
-
return this.staleCallStack;
|
|
454
|
-
}
|
|
455
|
-
getTopStackFrame() {
|
|
456
|
-
const callStack = this.getCallStack();
|
|
457
|
-
const firstAvailableStackFrame = callStack.find(sf => !!(sf &&
|
|
458
|
-
((this.stoppedDetails?.reason === 'instruction breakpoint' || (this.stoppedDetails?.reason === 'step' && this.lastSteppingGranularity === 'instruction')) && sf.instructionPointerReference) ||
|
|
459
|
-
(sf.source && sf.source.available && sf.source.presentationHint !== 'deemphasize')));
|
|
460
|
-
return firstAvailableStackFrame;
|
|
461
|
-
}
|
|
462
|
-
get stateLabel() {
|
|
463
|
-
if (this.stoppedDetails) {
|
|
464
|
-
return this.stoppedDetails.description ||
|
|
465
|
-
(this.stoppedDetails.reason ? ( nls.localizeWithPath(
|
|
466
|
-
'vs/workbench/contrib/debug/common/debugModel',
|
|
467
|
-
{ key: 'pausedOn', comment: ['indicates reason for program being paused'] },
|
|
468
|
-
"Paused on {0}",
|
|
469
|
-
this.stoppedDetails.reason
|
|
470
|
-
)) : ( nls.localizeWithPath('vs/workbench/contrib/debug/common/debugModel', 'paused', "Paused")));
|
|
471
|
-
}
|
|
472
|
-
return ( nls.localizeWithPath(
|
|
473
|
-
'vs/workbench/contrib/debug/common/debugModel',
|
|
474
|
-
{ key: 'running', comment: ['indicates state'] },
|
|
475
|
-
"Running"
|
|
476
|
-
));
|
|
477
|
-
}
|
|
478
|
-
async fetchCallStack(levels = 20) {
|
|
479
|
-
if (this.stopped) {
|
|
480
|
-
const start = this.callStack.length;
|
|
481
|
-
const callStack = await this.getCallStackImpl(start, levels);
|
|
482
|
-
this.reachedEndOfCallStack = callStack.length < levels;
|
|
483
|
-
if (start < this.callStack.length) {
|
|
484
|
-
this.callStack.splice(start, this.callStack.length - start);
|
|
485
|
-
}
|
|
486
|
-
this.callStack = this.callStack.concat(callStack || []);
|
|
487
|
-
if (typeof this.stoppedDetails?.totalFrames === 'number' && this.stoppedDetails.totalFrames === this.callStack.length) {
|
|
488
|
-
this.reachedEndOfCallStack = true;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
async getCallStackImpl(startFrame, levels) {
|
|
493
|
-
try {
|
|
494
|
-
const tokenSource = ( new CancellationTokenSource());
|
|
495
|
-
this.callStackCancellationTokens.push(tokenSource);
|
|
496
|
-
const response = await this.session.stackTrace(this.threadId, startFrame, levels, tokenSource.token);
|
|
497
|
-
if (!response || !response.body || tokenSource.token.isCancellationRequested) {
|
|
498
|
-
return [];
|
|
499
|
-
}
|
|
500
|
-
if (this.stoppedDetails) {
|
|
501
|
-
this.stoppedDetails.totalFrames = response.body.totalFrames;
|
|
502
|
-
}
|
|
503
|
-
return ( response.body.stackFrames.map((rsf, index) => {
|
|
504
|
-
const source = this.session.getSource(rsf.source);
|
|
505
|
-
return ( new StackFrame(this, rsf.id, source, rsf.name, rsf.presentationHint, ( new Range(rsf.line, rsf.column, rsf.endLine || rsf.line, rsf.endColumn || rsf.column)), startFrame + index, typeof rsf.canRestart === 'boolean' ? rsf.canRestart : true, rsf.instructionPointerReference));
|
|
506
|
-
}));
|
|
507
|
-
}
|
|
508
|
-
catch (err) {
|
|
509
|
-
if (this.stoppedDetails) {
|
|
510
|
-
this.stoppedDetails.framesErrorMessage = err.message;
|
|
511
|
-
}
|
|
512
|
-
return [];
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
get exceptionInfo() {
|
|
516
|
-
if (this.stoppedDetails && this.stoppedDetails.reason === 'exception') {
|
|
517
|
-
if (this.session.capabilities.supportsExceptionInfoRequest) {
|
|
518
|
-
return this.session.exceptionInfo(this.threadId);
|
|
519
|
-
}
|
|
520
|
-
return Promise.resolve({
|
|
521
|
-
description: this.stoppedDetails.text,
|
|
522
|
-
breakMode: null
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
return Promise.resolve(undefined);
|
|
526
|
-
}
|
|
527
|
-
next(granularity) {
|
|
528
|
-
return this.session.next(this.threadId, granularity);
|
|
529
|
-
}
|
|
530
|
-
stepIn(granularity) {
|
|
531
|
-
return this.session.stepIn(this.threadId, undefined, granularity);
|
|
532
|
-
}
|
|
533
|
-
stepOut(granularity) {
|
|
534
|
-
return this.session.stepOut(this.threadId, granularity);
|
|
535
|
-
}
|
|
536
|
-
stepBack(granularity) {
|
|
537
|
-
return this.session.stepBack(this.threadId, granularity);
|
|
538
|
-
}
|
|
539
|
-
continue() {
|
|
540
|
-
return this.session.continue(this.threadId);
|
|
541
|
-
}
|
|
542
|
-
pause() {
|
|
543
|
-
return this.session.pause(this.threadId);
|
|
544
|
-
}
|
|
545
|
-
terminate() {
|
|
546
|
-
return this.session.terminateThreads([this.threadId]);
|
|
547
|
-
}
|
|
548
|
-
reverseContinue() {
|
|
549
|
-
return this.session.reverseContinue(this.threadId);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
const getUriForDebugMemory = (sessionId, memoryReference, range, displayName = 'memory') => {
|
|
553
|
-
return ( URI.from({
|
|
554
|
-
scheme: DEBUG_MEMORY_SCHEME,
|
|
555
|
-
authority: sessionId,
|
|
556
|
-
path: '/' + encodeURIComponent(memoryReference) + `/${encodeURIComponent(displayName)}.bin`,
|
|
557
|
-
query: range ? `?range=${range.fromOffset}:${range.toOffset}` : undefined,
|
|
558
|
-
}));
|
|
559
|
-
};
|
|
560
|
-
class MemoryRegion extends Disposable {
|
|
561
|
-
constructor(memoryReference, session) {
|
|
562
|
-
super();
|
|
563
|
-
this.memoryReference = memoryReference;
|
|
564
|
-
this.session = session;
|
|
565
|
-
this.invalidateEmitter = this._register(( new Emitter()));
|
|
566
|
-
this.onDidInvalidate = this.invalidateEmitter.event;
|
|
567
|
-
this.writable = !!this.session.capabilities.supportsWriteMemoryRequest;
|
|
568
|
-
this._register(session.onDidInvalidateMemory(e => {
|
|
569
|
-
if (e.body.memoryReference === memoryReference) {
|
|
570
|
-
this.invalidate(e.body.offset, e.body.count - e.body.offset);
|
|
571
|
-
}
|
|
572
|
-
}));
|
|
573
|
-
}
|
|
574
|
-
async read(fromOffset, toOffset) {
|
|
575
|
-
const length = toOffset - fromOffset;
|
|
576
|
-
const offset = fromOffset;
|
|
577
|
-
const result = await this.session.readMemory(this.memoryReference, offset, length);
|
|
578
|
-
if (result === undefined || !result.body?.data) {
|
|
579
|
-
return [{ type: 1 , offset, length }];
|
|
580
|
-
}
|
|
581
|
-
let data;
|
|
582
|
-
try {
|
|
583
|
-
data = decodeBase64(result.body.data);
|
|
584
|
-
}
|
|
585
|
-
catch {
|
|
586
|
-
return [{ type: 2 , offset, length, error: 'Invalid base64 data from debug adapter' }];
|
|
587
|
-
}
|
|
588
|
-
const unreadable = result.body.unreadableBytes || 0;
|
|
589
|
-
const dataLength = length - unreadable;
|
|
590
|
-
if (data.byteLength < dataLength) {
|
|
591
|
-
const pad = VSBuffer.alloc(dataLength - data.byteLength);
|
|
592
|
-
pad.buffer.fill(0);
|
|
593
|
-
data = VSBuffer.concat([data, pad], dataLength);
|
|
594
|
-
}
|
|
595
|
-
else if (data.byteLength > dataLength) {
|
|
596
|
-
data = data.slice(0, dataLength);
|
|
597
|
-
}
|
|
598
|
-
if (!unreadable) {
|
|
599
|
-
return [{ type: 0 , offset, length, data }];
|
|
600
|
-
}
|
|
601
|
-
return [
|
|
602
|
-
{ type: 0 , offset, length: dataLength, data },
|
|
603
|
-
{ type: 1 , offset: offset + dataLength, length: unreadable },
|
|
604
|
-
];
|
|
605
|
-
}
|
|
606
|
-
async write(offset, data) {
|
|
607
|
-
const result = await this.session.writeMemory(this.memoryReference, offset, encodeBase64(data), true);
|
|
608
|
-
const written = result?.body?.bytesWritten ?? data.byteLength;
|
|
609
|
-
this.invalidate(offset, offset + written);
|
|
610
|
-
return written;
|
|
611
|
-
}
|
|
612
|
-
dispose() {
|
|
613
|
-
super.dispose();
|
|
614
|
-
}
|
|
615
|
-
invalidate(fromOffset, toOffset) {
|
|
616
|
-
this.invalidateEmitter.fire({ fromOffset, toOffset });
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
class Enablement {
|
|
620
|
-
constructor(enabled, id) {
|
|
621
|
-
this.enabled = enabled;
|
|
622
|
-
this.id = id;
|
|
623
|
-
}
|
|
624
|
-
getId() {
|
|
625
|
-
return this.id;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
function toBreakpointSessionData(data, capabilities) {
|
|
629
|
-
return mixin({
|
|
630
|
-
supportsConditionalBreakpoints: !!capabilities.supportsConditionalBreakpoints,
|
|
631
|
-
supportsHitConditionalBreakpoints: !!capabilities.supportsHitConditionalBreakpoints,
|
|
632
|
-
supportsLogPoints: !!capabilities.supportsLogPoints,
|
|
633
|
-
supportsFunctionBreakpoints: !!capabilities.supportsFunctionBreakpoints,
|
|
634
|
-
supportsDataBreakpoints: !!capabilities.supportsDataBreakpoints,
|
|
635
|
-
supportsInstructionBreakpoints: !!capabilities.supportsInstructionBreakpoints
|
|
636
|
-
}, data);
|
|
637
|
-
}
|
|
638
|
-
class BaseBreakpoint extends Enablement {
|
|
639
|
-
constructor(enabled, hitCondition, condition, logMessage, id) {
|
|
640
|
-
super(enabled, id);
|
|
641
|
-
this.hitCondition = hitCondition;
|
|
642
|
-
this.condition = condition;
|
|
643
|
-
this.logMessage = logMessage;
|
|
644
|
-
this.sessionData = ( new Map());
|
|
645
|
-
if (enabled === undefined) {
|
|
646
|
-
this.enabled = true;
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
setSessionData(sessionId, data) {
|
|
650
|
-
if (!data) {
|
|
651
|
-
this.sessionData.delete(sessionId);
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
data.sessionId = sessionId;
|
|
655
|
-
this.sessionData.set(sessionId, data);
|
|
656
|
-
}
|
|
657
|
-
const allData = Array.from(( this.sessionData.values()));
|
|
658
|
-
const verifiedData = distinct(allData.filter(d => d.verified), d => `${d.line}:${d.column}`);
|
|
659
|
-
if (verifiedData.length) {
|
|
660
|
-
this.data = verifiedData.length === 1 ? verifiedData[0] : undefined;
|
|
661
|
-
}
|
|
662
|
-
else {
|
|
663
|
-
this.data = allData.length ? allData[0] : undefined;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
get message() {
|
|
667
|
-
if (!this.data) {
|
|
668
|
-
return undefined;
|
|
669
|
-
}
|
|
670
|
-
return this.data.message;
|
|
671
|
-
}
|
|
672
|
-
get verified() {
|
|
673
|
-
return this.data ? this.data.verified : true;
|
|
674
|
-
}
|
|
675
|
-
get sessionsThatVerified() {
|
|
676
|
-
const sessionIds = [];
|
|
677
|
-
for (const [sessionId, data] of this.sessionData) {
|
|
678
|
-
if (data.verified) {
|
|
679
|
-
sessionIds.push(sessionId);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
return sessionIds;
|
|
683
|
-
}
|
|
684
|
-
getIdFromAdapter(sessionId) {
|
|
685
|
-
const data = this.sessionData.get(sessionId);
|
|
686
|
-
return data ? data.id : undefined;
|
|
687
|
-
}
|
|
688
|
-
getDebugProtocolBreakpoint(sessionId) {
|
|
689
|
-
const data = this.sessionData.get(sessionId);
|
|
690
|
-
if (data) {
|
|
691
|
-
const bp = {
|
|
692
|
-
id: data.id,
|
|
693
|
-
verified: data.verified,
|
|
694
|
-
message: data.message,
|
|
695
|
-
source: data.source,
|
|
696
|
-
line: data.line,
|
|
697
|
-
column: data.column,
|
|
698
|
-
endLine: data.endLine,
|
|
699
|
-
endColumn: data.endColumn,
|
|
700
|
-
instructionReference: data.instructionReference,
|
|
701
|
-
offset: data.offset
|
|
702
|
-
};
|
|
703
|
-
return bp;
|
|
704
|
-
}
|
|
705
|
-
return undefined;
|
|
706
|
-
}
|
|
707
|
-
toJSON() {
|
|
708
|
-
const result = Object.create(null);
|
|
709
|
-
result.id = this.getId();
|
|
710
|
-
result.enabled = this.enabled;
|
|
711
|
-
result.condition = this.condition;
|
|
712
|
-
result.hitCondition = this.hitCondition;
|
|
713
|
-
result.logMessage = this.logMessage;
|
|
714
|
-
return result;
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
class Breakpoint extends BaseBreakpoint {
|
|
718
|
-
constructor(_uri, _lineNumber, _column, enabled, condition, hitCondition, logMessage, _adapterData, textFileService, uriIdentityService, logService, id = generateUuid()) {
|
|
719
|
-
super(enabled, hitCondition, condition, logMessage, id);
|
|
720
|
-
this._uri = _uri;
|
|
721
|
-
this._lineNumber = _lineNumber;
|
|
722
|
-
this._column = _column;
|
|
723
|
-
this._adapterData = _adapterData;
|
|
724
|
-
this.textFileService = textFileService;
|
|
725
|
-
this.uriIdentityService = uriIdentityService;
|
|
726
|
-
this.logService = logService;
|
|
727
|
-
}
|
|
728
|
-
get originalUri() {
|
|
729
|
-
return this._uri;
|
|
730
|
-
}
|
|
731
|
-
get lineNumber() {
|
|
732
|
-
return this.verified && this.data && typeof this.data.line === 'number' ? this.data.line : this._lineNumber;
|
|
733
|
-
}
|
|
734
|
-
get verified() {
|
|
735
|
-
if (this.data) {
|
|
736
|
-
return this.data.verified && !this.textFileService.isDirty(this._uri);
|
|
737
|
-
}
|
|
738
|
-
return true;
|
|
739
|
-
}
|
|
740
|
-
get uri() {
|
|
741
|
-
return this.verified && this.data && this.data.source ? getUriFromSource(this.data.source, this.data.source.path, this.data.sessionId, this.uriIdentityService, this.logService) : this._uri;
|
|
742
|
-
}
|
|
743
|
-
get column() {
|
|
744
|
-
return this.verified && this.data && typeof this.data.column === 'number' ? this.data.column : this._column;
|
|
745
|
-
}
|
|
746
|
-
get message() {
|
|
747
|
-
if (this.textFileService.isDirty(this.uri)) {
|
|
748
|
-
return ( nls.localizeWithPath(
|
|
749
|
-
'vs/workbench/contrib/debug/common/debugModel',
|
|
750
|
-
'breakpointDirtydHover',
|
|
751
|
-
"Unverified breakpoint. File is modified, please restart debug session."
|
|
752
|
-
));
|
|
753
|
-
}
|
|
754
|
-
return super.message;
|
|
755
|
-
}
|
|
756
|
-
get adapterData() {
|
|
757
|
-
return this.data && this.data.source && this.data.source.adapterData ? this.data.source.adapterData : this._adapterData;
|
|
758
|
-
}
|
|
759
|
-
get endLineNumber() {
|
|
760
|
-
return this.verified && this.data ? this.data.endLine : undefined;
|
|
761
|
-
}
|
|
762
|
-
get endColumn() {
|
|
763
|
-
return this.verified && this.data ? this.data.endColumn : undefined;
|
|
764
|
-
}
|
|
765
|
-
get sessionAgnosticData() {
|
|
766
|
-
return {
|
|
767
|
-
lineNumber: this._lineNumber,
|
|
768
|
-
column: this._column
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
get supported() {
|
|
772
|
-
if (!this.data) {
|
|
773
|
-
return true;
|
|
774
|
-
}
|
|
775
|
-
if (this.logMessage && !this.data.supportsLogPoints) {
|
|
776
|
-
return false;
|
|
777
|
-
}
|
|
778
|
-
if (this.condition && !this.data.supportsConditionalBreakpoints) {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
if (this.hitCondition && !this.data.supportsHitConditionalBreakpoints) {
|
|
782
|
-
return false;
|
|
783
|
-
}
|
|
784
|
-
return true;
|
|
785
|
-
}
|
|
786
|
-
setSessionData(sessionId, data) {
|
|
787
|
-
super.setSessionData(sessionId, data);
|
|
788
|
-
if (!this._adapterData) {
|
|
789
|
-
this._adapterData = this.adapterData;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
toJSON() {
|
|
793
|
-
const result = super.toJSON();
|
|
794
|
-
result.uri = this._uri;
|
|
795
|
-
result.lineNumber = this._lineNumber;
|
|
796
|
-
result.column = this._column;
|
|
797
|
-
result.adapterData = this.adapterData;
|
|
798
|
-
return result;
|
|
799
|
-
}
|
|
800
|
-
toString() {
|
|
801
|
-
return `${resources.basenameOrAuthority(this.uri)} ${this.lineNumber}`;
|
|
802
|
-
}
|
|
803
|
-
update(data) {
|
|
804
|
-
if (!isUndefinedOrNull(data.lineNumber)) {
|
|
805
|
-
this._lineNumber = data.lineNumber;
|
|
806
|
-
}
|
|
807
|
-
if (!isUndefinedOrNull(data.column)) {
|
|
808
|
-
this._column = data.column;
|
|
809
|
-
}
|
|
810
|
-
if (!isUndefinedOrNull(data.condition)) {
|
|
811
|
-
this.condition = data.condition;
|
|
812
|
-
}
|
|
813
|
-
if (!isUndefinedOrNull(data.hitCondition)) {
|
|
814
|
-
this.hitCondition = data.hitCondition;
|
|
815
|
-
}
|
|
816
|
-
if (!isUndefinedOrNull(data.logMessage)) {
|
|
817
|
-
this.logMessage = data.logMessage;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
class FunctionBreakpoint extends BaseBreakpoint {
|
|
822
|
-
constructor(name, enabled, hitCondition, condition, logMessage, id = generateUuid()) {
|
|
823
|
-
super(enabled, hitCondition, condition, logMessage, id);
|
|
824
|
-
this.name = name;
|
|
825
|
-
}
|
|
826
|
-
toJSON() {
|
|
827
|
-
const result = super.toJSON();
|
|
828
|
-
result.name = this.name;
|
|
829
|
-
return result;
|
|
830
|
-
}
|
|
831
|
-
get supported() {
|
|
832
|
-
if (!this.data) {
|
|
833
|
-
return true;
|
|
834
|
-
}
|
|
835
|
-
return this.data.supportsFunctionBreakpoints;
|
|
836
|
-
}
|
|
837
|
-
toString() {
|
|
838
|
-
return this.name;
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
class DataBreakpoint extends BaseBreakpoint {
|
|
842
|
-
constructor(description, dataId, canPersist, enabled, hitCondition, condition, logMessage, accessTypes, accessType, id = generateUuid()) {
|
|
843
|
-
super(enabled, hitCondition, condition, logMessage, id);
|
|
844
|
-
this.description = description;
|
|
845
|
-
this.dataId = dataId;
|
|
846
|
-
this.canPersist = canPersist;
|
|
847
|
-
this.accessTypes = accessTypes;
|
|
848
|
-
this.accessType = accessType;
|
|
849
|
-
}
|
|
850
|
-
toJSON() {
|
|
851
|
-
const result = super.toJSON();
|
|
852
|
-
result.description = this.description;
|
|
853
|
-
result.dataId = this.dataId;
|
|
854
|
-
result.accessTypes = this.accessTypes;
|
|
855
|
-
result.accessType = this.accessType;
|
|
856
|
-
return result;
|
|
857
|
-
}
|
|
858
|
-
get supported() {
|
|
859
|
-
if (!this.data) {
|
|
860
|
-
return true;
|
|
861
|
-
}
|
|
862
|
-
return this.data.supportsDataBreakpoints;
|
|
863
|
-
}
|
|
864
|
-
toString() {
|
|
865
|
-
return this.description;
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
class ExceptionBreakpoint extends BaseBreakpoint {
|
|
869
|
-
constructor(filter, label, enabled, supportsCondition, condition, description, conditionDescription, fallback = false) {
|
|
870
|
-
super(enabled, undefined, condition, undefined, generateUuid());
|
|
871
|
-
this.filter = filter;
|
|
872
|
-
this.label = label;
|
|
873
|
-
this.supportsCondition = supportsCondition;
|
|
874
|
-
this.description = description;
|
|
875
|
-
this.conditionDescription = conditionDescription;
|
|
876
|
-
this.fallback = fallback;
|
|
877
|
-
this.supportedSessions = ( new Set());
|
|
878
|
-
}
|
|
879
|
-
toJSON() {
|
|
880
|
-
const result = Object.create(null);
|
|
881
|
-
result.filter = this.filter;
|
|
882
|
-
result.label = this.label;
|
|
883
|
-
result.enabled = this.enabled;
|
|
884
|
-
result.supportsCondition = this.supportsCondition;
|
|
885
|
-
result.conditionDescription = this.conditionDescription;
|
|
886
|
-
result.condition = this.condition;
|
|
887
|
-
result.fallback = this.fallback;
|
|
888
|
-
result.description = this.description;
|
|
889
|
-
return result;
|
|
890
|
-
}
|
|
891
|
-
setSupportedSession(sessionId, supported) {
|
|
892
|
-
if (supported) {
|
|
893
|
-
this.supportedSessions.add(sessionId);
|
|
894
|
-
}
|
|
895
|
-
else {
|
|
896
|
-
this.supportedSessions.delete(sessionId);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
setFallback(isFallback) {
|
|
900
|
-
this.fallback = isFallback;
|
|
901
|
-
}
|
|
902
|
-
get supported() {
|
|
903
|
-
return true;
|
|
904
|
-
}
|
|
905
|
-
isSupportedSession(sessionId) {
|
|
906
|
-
return sessionId ? ( this.supportedSessions.has(sessionId)) : this.fallback;
|
|
907
|
-
}
|
|
908
|
-
matches(filter) {
|
|
909
|
-
return this.filter === filter.filter && this.label === filter.label && this.supportsCondition === !!filter.supportsCondition && this.conditionDescription === filter.conditionDescription && this.description === filter.description;
|
|
910
|
-
}
|
|
911
|
-
toString() {
|
|
912
|
-
return this.label;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
class InstructionBreakpoint extends BaseBreakpoint {
|
|
916
|
-
constructor(instructionReference, offset, canPersist, enabled, hitCondition, condition, logMessage, address, id = generateUuid()) {
|
|
917
|
-
super(enabled, hitCondition, condition, logMessage, id);
|
|
918
|
-
this.instructionReference = instructionReference;
|
|
919
|
-
this.offset = offset;
|
|
920
|
-
this.canPersist = canPersist;
|
|
921
|
-
this.address = address;
|
|
922
|
-
}
|
|
923
|
-
toJSON() {
|
|
924
|
-
const result = super.toJSON();
|
|
925
|
-
result.instructionReference = this.instructionReference;
|
|
926
|
-
result.offset = this.offset;
|
|
927
|
-
return result;
|
|
928
|
-
}
|
|
929
|
-
get supported() {
|
|
930
|
-
if (!this.data) {
|
|
931
|
-
return true;
|
|
932
|
-
}
|
|
933
|
-
return this.data.supportsInstructionBreakpoints;
|
|
934
|
-
}
|
|
935
|
-
toString() {
|
|
936
|
-
return this.instructionReference;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
class ThreadAndSessionIds {
|
|
940
|
-
constructor(sessionId, threadId) {
|
|
941
|
-
this.sessionId = sessionId;
|
|
942
|
-
this.threadId = threadId;
|
|
943
|
-
}
|
|
944
|
-
getId() {
|
|
945
|
-
return `${this.sessionId}:${this.threadId}`;
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
let DebugModel = class DebugModel extends Disposable {
|
|
949
|
-
constructor(debugStorage, textFileService, uriIdentityService, logService) {
|
|
950
|
-
super();
|
|
951
|
-
this.textFileService = textFileService;
|
|
952
|
-
this.uriIdentityService = uriIdentityService;
|
|
953
|
-
this.logService = logService;
|
|
954
|
-
this.schedulers = ( new Map());
|
|
955
|
-
this.breakpointsActivated = true;
|
|
956
|
-
this._onDidChangeBreakpoints = this._register(( new Emitter()));
|
|
957
|
-
this._onDidChangeCallStack = this._register(( new Emitter()));
|
|
958
|
-
this._onDidChangeWatchExpressions = this._register(( new Emitter()));
|
|
959
|
-
this._register(autorun(reader => {
|
|
960
|
-
this.breakpoints = debugStorage.breakpoints.read(reader);
|
|
961
|
-
this.functionBreakpoints = debugStorage.functionBreakpoints.read(reader);
|
|
962
|
-
this.exceptionBreakpoints = debugStorage.exceptionBreakpoints.read(reader);
|
|
963
|
-
this.dataBreakpoints = debugStorage.dataBreakpoints.read(reader);
|
|
964
|
-
this._onDidChangeBreakpoints.fire(undefined);
|
|
965
|
-
}));
|
|
966
|
-
this._register(autorun(reader => {
|
|
967
|
-
this.watchExpressions = debugStorage.watchExpressions.read(reader);
|
|
968
|
-
this._onDidChangeWatchExpressions.fire(undefined);
|
|
969
|
-
}));
|
|
970
|
-
this.instructionBreakpoints = [];
|
|
971
|
-
this.sessions = [];
|
|
972
|
-
}
|
|
973
|
-
getId() {
|
|
974
|
-
return 'root';
|
|
975
|
-
}
|
|
976
|
-
getSession(sessionId, includeInactive = false) {
|
|
977
|
-
if (sessionId) {
|
|
978
|
-
return this.getSessions(includeInactive).find(s => s.getId() === sessionId);
|
|
979
|
-
}
|
|
980
|
-
return undefined;
|
|
981
|
-
}
|
|
982
|
-
getSessions(includeInactive = false) {
|
|
983
|
-
return this.sessions.filter(s => includeInactive || s.state !== 0 );
|
|
984
|
-
}
|
|
985
|
-
addSession(session) {
|
|
986
|
-
this.sessions = this.sessions.filter(s => {
|
|
987
|
-
if (s.getId() === session.getId()) {
|
|
988
|
-
return false;
|
|
989
|
-
}
|
|
990
|
-
if (s.state === 0 && s.configuration.name === session.configuration.name) {
|
|
991
|
-
return false;
|
|
992
|
-
}
|
|
993
|
-
return true;
|
|
994
|
-
});
|
|
995
|
-
let i = 1;
|
|
996
|
-
while (( this.sessions.some(s => s.getLabel() === session.getLabel()))) {
|
|
997
|
-
session.setName(`${session.configuration.name} ${++i}`);
|
|
998
|
-
}
|
|
999
|
-
let index = -1;
|
|
1000
|
-
if (session.parentSession) {
|
|
1001
|
-
index = findLastIdx(this.sessions, s => s.parentSession === session.parentSession || s === session.parentSession);
|
|
1002
|
-
}
|
|
1003
|
-
if (index >= 0) {
|
|
1004
|
-
this.sessions.splice(index + 1, 0, session);
|
|
1005
|
-
}
|
|
1006
|
-
else {
|
|
1007
|
-
this.sessions.push(session);
|
|
1008
|
-
}
|
|
1009
|
-
this._onDidChangeCallStack.fire(undefined);
|
|
1010
|
-
}
|
|
1011
|
-
get onDidChangeBreakpoints() {
|
|
1012
|
-
return this._onDidChangeBreakpoints.event;
|
|
1013
|
-
}
|
|
1014
|
-
get onDidChangeCallStack() {
|
|
1015
|
-
return this._onDidChangeCallStack.event;
|
|
1016
|
-
}
|
|
1017
|
-
get onDidChangeWatchExpressions() {
|
|
1018
|
-
return this._onDidChangeWatchExpressions.event;
|
|
1019
|
-
}
|
|
1020
|
-
rawUpdate(data) {
|
|
1021
|
-
const session = this.sessions.find(p => p.getId() === data.sessionId);
|
|
1022
|
-
if (session) {
|
|
1023
|
-
session.rawUpdate(data);
|
|
1024
|
-
this._onDidChangeCallStack.fire(undefined);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
clearThreads(id, removeThreads, reference = undefined) {
|
|
1028
|
-
const session = this.sessions.find(p => p.getId() === id);
|
|
1029
|
-
this.schedulers.forEach(entry => {
|
|
1030
|
-
entry.scheduler.dispose();
|
|
1031
|
-
entry.completeDeferred.complete();
|
|
1032
|
-
});
|
|
1033
|
-
this.schedulers.clear();
|
|
1034
|
-
if (session) {
|
|
1035
|
-
session.clearThreads(removeThreads, reference);
|
|
1036
|
-
this._onDidChangeCallStack.fire(undefined);
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
async fetchCallstack(thread, levels) {
|
|
1040
|
-
if (thread.reachedEndOfCallStack) {
|
|
1041
|
-
return;
|
|
1042
|
-
}
|
|
1043
|
-
const totalFrames = thread.stoppedDetails?.totalFrames;
|
|
1044
|
-
const remainingFrames = (typeof totalFrames === 'number') ? (totalFrames - thread.getCallStack().length) : undefined;
|
|
1045
|
-
if (!levels || (remainingFrames && levels > remainingFrames)) {
|
|
1046
|
-
levels = remainingFrames;
|
|
1047
|
-
}
|
|
1048
|
-
if (levels && levels > 0) {
|
|
1049
|
-
await thread.fetchCallStack(levels);
|
|
1050
|
-
this._onDidChangeCallStack.fire();
|
|
1051
|
-
}
|
|
1052
|
-
return;
|
|
1053
|
-
}
|
|
1054
|
-
refreshTopOfCallstack(thread, fetchFullStack = true) {
|
|
1055
|
-
if (thread.session.capabilities.supportsDelayedStackTraceLoading) {
|
|
1056
|
-
let topCallStack = Promise.resolve();
|
|
1057
|
-
const wholeCallStack = ( new Promise((c, e) => {
|
|
1058
|
-
topCallStack = thread.fetchCallStack(1).then(() => {
|
|
1059
|
-
if (!( this.schedulers.has(thread.getId())) && fetchFullStack) {
|
|
1060
|
-
const deferred = ( new DeferredPromise());
|
|
1061
|
-
this.schedulers.set(thread.getId(), {
|
|
1062
|
-
completeDeferred: deferred,
|
|
1063
|
-
scheduler: ( new RunOnceScheduler(() => {
|
|
1064
|
-
thread.fetchCallStack(19).then(() => {
|
|
1065
|
-
const stale = thread.getStaleCallStack();
|
|
1066
|
-
const current = thread.getCallStack();
|
|
1067
|
-
let bottomOfCallStackChanged = stale.length !== current.length;
|
|
1068
|
-
for (let i = 1; i < stale.length && !bottomOfCallStackChanged; i++) {
|
|
1069
|
-
bottomOfCallStackChanged = !stale[i].equals(current[i]);
|
|
1070
|
-
}
|
|
1071
|
-
if (bottomOfCallStackChanged) {
|
|
1072
|
-
this._onDidChangeCallStack.fire();
|
|
1073
|
-
}
|
|
1074
|
-
}).finally(() => {
|
|
1075
|
-
deferred.complete();
|
|
1076
|
-
this.schedulers.delete(thread.getId());
|
|
1077
|
-
});
|
|
1078
|
-
}, 420))
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
const entry = this.schedulers.get(thread.getId());
|
|
1082
|
-
entry.scheduler.schedule();
|
|
1083
|
-
entry.completeDeferred.p.then(c, e);
|
|
1084
|
-
this._onDidChangeCallStack.fire();
|
|
1085
|
-
});
|
|
1086
|
-
}));
|
|
1087
|
-
return { topCallStack, wholeCallStack };
|
|
1088
|
-
}
|
|
1089
|
-
const wholeCallStack = thread.fetchCallStack();
|
|
1090
|
-
return { wholeCallStack, topCallStack: wholeCallStack };
|
|
1091
|
-
}
|
|
1092
|
-
getBreakpoints(filter) {
|
|
1093
|
-
if (filter) {
|
|
1094
|
-
const uriStr = filter.uri?.toString();
|
|
1095
|
-
const originalUriStr = filter.originalUri?.toString();
|
|
1096
|
-
return this.breakpoints.filter(bp => {
|
|
1097
|
-
if (uriStr && ( bp.uri.toString()) !== uriStr) {
|
|
1098
|
-
return false;
|
|
1099
|
-
}
|
|
1100
|
-
if (originalUriStr && ( bp.originalUri.toString()) !== originalUriStr) {
|
|
1101
|
-
return false;
|
|
1102
|
-
}
|
|
1103
|
-
if (filter.lineNumber && bp.lineNumber !== filter.lineNumber) {
|
|
1104
|
-
return false;
|
|
1105
|
-
}
|
|
1106
|
-
if (filter.column && bp.column !== filter.column) {
|
|
1107
|
-
return false;
|
|
1108
|
-
}
|
|
1109
|
-
if (filter.enabledOnly && (!this.breakpointsActivated || !bp.enabled)) {
|
|
1110
|
-
return false;
|
|
1111
|
-
}
|
|
1112
|
-
return true;
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1115
|
-
return this.breakpoints;
|
|
1116
|
-
}
|
|
1117
|
-
getFunctionBreakpoints() {
|
|
1118
|
-
return this.functionBreakpoints;
|
|
1119
|
-
}
|
|
1120
|
-
getDataBreakpoints() {
|
|
1121
|
-
return this.dataBreakpoints;
|
|
1122
|
-
}
|
|
1123
|
-
getExceptionBreakpoints() {
|
|
1124
|
-
return this.exceptionBreakpoints;
|
|
1125
|
-
}
|
|
1126
|
-
getExceptionBreakpointsForSession(sessionId) {
|
|
1127
|
-
return this.exceptionBreakpoints.filter(ebp => ebp.isSupportedSession(sessionId));
|
|
1128
|
-
}
|
|
1129
|
-
getInstructionBreakpoints() {
|
|
1130
|
-
return this.instructionBreakpoints;
|
|
1131
|
-
}
|
|
1132
|
-
setExceptionBreakpointsForSession(sessionId, data) {
|
|
1133
|
-
if (data) {
|
|
1134
|
-
let didChangeBreakpoints = false;
|
|
1135
|
-
data.forEach(d => {
|
|
1136
|
-
let ebp = this.exceptionBreakpoints.filter((exbp) => exbp.matches(d)).pop();
|
|
1137
|
-
if (!ebp) {
|
|
1138
|
-
didChangeBreakpoints = true;
|
|
1139
|
-
ebp = ( new ExceptionBreakpoint(
|
|
1140
|
-
d.filter,
|
|
1141
|
-
d.label,
|
|
1142
|
-
!!d.default,
|
|
1143
|
-
!!d.supportsCondition,
|
|
1144
|
-
undefined ,
|
|
1145
|
-
d.description,
|
|
1146
|
-
d.conditionDescription
|
|
1147
|
-
));
|
|
1148
|
-
this.exceptionBreakpoints.push(ebp);
|
|
1149
|
-
}
|
|
1150
|
-
ebp.setSupportedSession(sessionId, true);
|
|
1151
|
-
});
|
|
1152
|
-
if (didChangeBreakpoints) {
|
|
1153
|
-
this._onDidChangeBreakpoints.fire(undefined);
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
removeExceptionBreakpointsForSession(sessionId) {
|
|
1158
|
-
this.exceptionBreakpoints.forEach(ebp => ebp.setSupportedSession(sessionId, false));
|
|
1159
|
-
}
|
|
1160
|
-
setExceptionBreakpointFallbackSession(sessionId) {
|
|
1161
|
-
this.exceptionBreakpoints.forEach(ebp => ebp.setFallback(ebp.isSupportedSession(sessionId)));
|
|
1162
|
-
}
|
|
1163
|
-
setExceptionBreakpointCondition(exceptionBreakpoint, condition) {
|
|
1164
|
-
exceptionBreakpoint.condition = condition;
|
|
1165
|
-
this._onDidChangeBreakpoints.fire(undefined);
|
|
1166
|
-
}
|
|
1167
|
-
areBreakpointsActivated() {
|
|
1168
|
-
return this.breakpointsActivated;
|
|
1169
|
-
}
|
|
1170
|
-
setBreakpointsActivated(activated) {
|
|
1171
|
-
this.breakpointsActivated = activated;
|
|
1172
|
-
this._onDidChangeBreakpoints.fire(undefined);
|
|
1173
|
-
}
|
|
1174
|
-
addBreakpoints(uri, rawData, fireEvent = true) {
|
|
1175
|
-
const newBreakpoints = ( rawData.map(rawBp => ( new Breakpoint(
|
|
1176
|
-
uri,
|
|
1177
|
-
rawBp.lineNumber,
|
|
1178
|
-
rawBp.column,
|
|
1179
|
-
rawBp.enabled === false ? false : true,
|
|
1180
|
-
rawBp.condition,
|
|
1181
|
-
rawBp.hitCondition,
|
|
1182
|
-
rawBp.logMessage,
|
|
1183
|
-
undefined,
|
|
1184
|
-
this.textFileService,
|
|
1185
|
-
this.uriIdentityService,
|
|
1186
|
-
this.logService,
|
|
1187
|
-
rawBp.id
|
|
1188
|
-
))));
|
|
1189
|
-
this.breakpoints = this.breakpoints.concat(newBreakpoints);
|
|
1190
|
-
this.breakpointsActivated = true;
|
|
1191
|
-
this.sortAndDeDup();
|
|
1192
|
-
if (fireEvent) {
|
|
1193
|
-
this._onDidChangeBreakpoints.fire({ added: newBreakpoints, sessionOnly: false });
|
|
1194
|
-
}
|
|
1195
|
-
return newBreakpoints;
|
|
1196
|
-
}
|
|
1197
|
-
removeBreakpoints(toRemove) {
|
|
1198
|
-
this.breakpoints = this.breakpoints.filter(bp => !( toRemove.some(toRemove => toRemove.getId() === bp.getId())));
|
|
1199
|
-
this._onDidChangeBreakpoints.fire({ removed: toRemove, sessionOnly: false });
|
|
1200
|
-
}
|
|
1201
|
-
updateBreakpoints(data) {
|
|
1202
|
-
const updated = [];
|
|
1203
|
-
this.breakpoints.forEach(bp => {
|
|
1204
|
-
const bpData = data.get(bp.getId());
|
|
1205
|
-
if (bpData) {
|
|
1206
|
-
bp.update(bpData);
|
|
1207
|
-
updated.push(bp);
|
|
1208
|
-
}
|
|
1209
|
-
});
|
|
1210
|
-
this.sortAndDeDup();
|
|
1211
|
-
this._onDidChangeBreakpoints.fire({ changed: updated, sessionOnly: false });
|
|
1212
|
-
}
|
|
1213
|
-
setBreakpointSessionData(sessionId, capabilites, data) {
|
|
1214
|
-
this.breakpoints.forEach(bp => {
|
|
1215
|
-
if (!data) {
|
|
1216
|
-
bp.setSessionData(sessionId, undefined);
|
|
1217
|
-
}
|
|
1218
|
-
else {
|
|
1219
|
-
const bpData = data.get(bp.getId());
|
|
1220
|
-
if (bpData) {
|
|
1221
|
-
bp.setSessionData(sessionId, toBreakpointSessionData(bpData, capabilites));
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
});
|
|
1225
|
-
this.functionBreakpoints.forEach(fbp => {
|
|
1226
|
-
if (!data) {
|
|
1227
|
-
fbp.setSessionData(sessionId, undefined);
|
|
1228
|
-
}
|
|
1229
|
-
else {
|
|
1230
|
-
const fbpData = data.get(fbp.getId());
|
|
1231
|
-
if (fbpData) {
|
|
1232
|
-
fbp.setSessionData(sessionId, toBreakpointSessionData(fbpData, capabilites));
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
});
|
|
1236
|
-
this.dataBreakpoints.forEach(dbp => {
|
|
1237
|
-
if (!data) {
|
|
1238
|
-
dbp.setSessionData(sessionId, undefined);
|
|
1239
|
-
}
|
|
1240
|
-
else {
|
|
1241
|
-
const dbpData = data.get(dbp.getId());
|
|
1242
|
-
if (dbpData) {
|
|
1243
|
-
dbp.setSessionData(sessionId, toBreakpointSessionData(dbpData, capabilites));
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1247
|
-
this.exceptionBreakpoints.forEach(ebp => {
|
|
1248
|
-
if (!data) {
|
|
1249
|
-
ebp.setSessionData(sessionId, undefined);
|
|
1250
|
-
}
|
|
1251
|
-
else {
|
|
1252
|
-
const ebpData = data.get(ebp.getId());
|
|
1253
|
-
if (ebpData) {
|
|
1254
|
-
ebp.setSessionData(sessionId, toBreakpointSessionData(ebpData, capabilites));
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
});
|
|
1258
|
-
this.instructionBreakpoints.forEach(ibp => {
|
|
1259
|
-
if (!data) {
|
|
1260
|
-
ibp.setSessionData(sessionId, undefined);
|
|
1261
|
-
}
|
|
1262
|
-
else {
|
|
1263
|
-
const ibpData = data.get(ibp.getId());
|
|
1264
|
-
if (ibpData) {
|
|
1265
|
-
ibp.setSessionData(sessionId, toBreakpointSessionData(ibpData, capabilites));
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
this._onDidChangeBreakpoints.fire({
|
|
1270
|
-
sessionOnly: true
|
|
1271
|
-
});
|
|
1272
|
-
}
|
|
1273
|
-
getDebugProtocolBreakpoint(breakpointId, sessionId) {
|
|
1274
|
-
const bp = this.breakpoints.find(bp => bp.getId() === breakpointId);
|
|
1275
|
-
if (bp) {
|
|
1276
|
-
return bp.getDebugProtocolBreakpoint(sessionId);
|
|
1277
|
-
}
|
|
1278
|
-
return undefined;
|
|
1279
|
-
}
|
|
1280
|
-
sortAndDeDup() {
|
|
1281
|
-
this.breakpoints = this.breakpoints.sort((first, second) => {
|
|
1282
|
-
if (( first.uri.toString()) !== ( second.uri.toString())) {
|
|
1283
|
-
return resources.basenameOrAuthority(first.uri).localeCompare(resources.basenameOrAuthority(second.uri));
|
|
1284
|
-
}
|
|
1285
|
-
if (first.lineNumber === second.lineNumber) {
|
|
1286
|
-
if (first.column && second.column) {
|
|
1287
|
-
return first.column - second.column;
|
|
1288
|
-
}
|
|
1289
|
-
return 1;
|
|
1290
|
-
}
|
|
1291
|
-
return first.lineNumber - second.lineNumber;
|
|
1292
|
-
});
|
|
1293
|
-
this.breakpoints = distinct(this.breakpoints, bp => `${( bp.uri.toString())}:${bp.lineNumber}:${bp.column}`);
|
|
1294
|
-
}
|
|
1295
|
-
setEnablement(element, enable) {
|
|
1296
|
-
if (element instanceof Breakpoint || element instanceof FunctionBreakpoint || element instanceof ExceptionBreakpoint || element instanceof DataBreakpoint || element instanceof InstructionBreakpoint) {
|
|
1297
|
-
const changed = [];
|
|
1298
|
-
if (element.enabled !== enable && (element instanceof Breakpoint || element instanceof FunctionBreakpoint || element instanceof DataBreakpoint || element instanceof InstructionBreakpoint)) {
|
|
1299
|
-
changed.push(element);
|
|
1300
|
-
}
|
|
1301
|
-
element.enabled = enable;
|
|
1302
|
-
if (enable) {
|
|
1303
|
-
this.breakpointsActivated = true;
|
|
1304
|
-
}
|
|
1305
|
-
this._onDidChangeBreakpoints.fire({ changed: changed, sessionOnly: false });
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
enableOrDisableAllBreakpoints(enable) {
|
|
1309
|
-
const changed = [];
|
|
1310
|
-
this.breakpoints.forEach(bp => {
|
|
1311
|
-
if (bp.enabled !== enable) {
|
|
1312
|
-
changed.push(bp);
|
|
1313
|
-
}
|
|
1314
|
-
bp.enabled = enable;
|
|
1315
|
-
});
|
|
1316
|
-
this.functionBreakpoints.forEach(fbp => {
|
|
1317
|
-
if (fbp.enabled !== enable) {
|
|
1318
|
-
changed.push(fbp);
|
|
1319
|
-
}
|
|
1320
|
-
fbp.enabled = enable;
|
|
1321
|
-
});
|
|
1322
|
-
this.dataBreakpoints.forEach(dbp => {
|
|
1323
|
-
if (dbp.enabled !== enable) {
|
|
1324
|
-
changed.push(dbp);
|
|
1325
|
-
}
|
|
1326
|
-
dbp.enabled = enable;
|
|
1327
|
-
});
|
|
1328
|
-
this.instructionBreakpoints.forEach(ibp => {
|
|
1329
|
-
if (ibp.enabled !== enable) {
|
|
1330
|
-
changed.push(ibp);
|
|
1331
|
-
}
|
|
1332
|
-
ibp.enabled = enable;
|
|
1333
|
-
});
|
|
1334
|
-
if (enable) {
|
|
1335
|
-
this.breakpointsActivated = true;
|
|
1336
|
-
}
|
|
1337
|
-
this._onDidChangeBreakpoints.fire({ changed: changed, sessionOnly: false });
|
|
1338
|
-
}
|
|
1339
|
-
addFunctionBreakpoint(functionName, id) {
|
|
1340
|
-
const newFunctionBreakpoint = ( new FunctionBreakpoint(functionName, true, undefined, undefined, undefined, id));
|
|
1341
|
-
this.functionBreakpoints.push(newFunctionBreakpoint);
|
|
1342
|
-
this._onDidChangeBreakpoints.fire({ added: [newFunctionBreakpoint], sessionOnly: false });
|
|
1343
|
-
return newFunctionBreakpoint;
|
|
1344
|
-
}
|
|
1345
|
-
updateFunctionBreakpoint(id, update) {
|
|
1346
|
-
const functionBreakpoint = this.functionBreakpoints.find(fbp => fbp.getId() === id);
|
|
1347
|
-
if (functionBreakpoint) {
|
|
1348
|
-
if (typeof update.name === 'string') {
|
|
1349
|
-
functionBreakpoint.name = update.name;
|
|
1350
|
-
}
|
|
1351
|
-
if (typeof update.condition === 'string') {
|
|
1352
|
-
functionBreakpoint.condition = update.condition;
|
|
1353
|
-
}
|
|
1354
|
-
if (typeof update.hitCondition === 'string') {
|
|
1355
|
-
functionBreakpoint.hitCondition = update.hitCondition;
|
|
1356
|
-
}
|
|
1357
|
-
this._onDidChangeBreakpoints.fire({ changed: [functionBreakpoint], sessionOnly: false });
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
removeFunctionBreakpoints(id) {
|
|
1361
|
-
let removed;
|
|
1362
|
-
if (id) {
|
|
1363
|
-
removed = this.functionBreakpoints.filter(fbp => fbp.getId() === id);
|
|
1364
|
-
this.functionBreakpoints = this.functionBreakpoints.filter(fbp => fbp.getId() !== id);
|
|
1365
|
-
}
|
|
1366
|
-
else {
|
|
1367
|
-
removed = this.functionBreakpoints;
|
|
1368
|
-
this.functionBreakpoints = [];
|
|
1369
|
-
}
|
|
1370
|
-
this._onDidChangeBreakpoints.fire({ removed, sessionOnly: false });
|
|
1371
|
-
}
|
|
1372
|
-
addDataBreakpoint(label, dataId, canPersist, accessTypes, accessType, id) {
|
|
1373
|
-
const newDataBreakpoint = ( new DataBreakpoint(
|
|
1374
|
-
label,
|
|
1375
|
-
dataId,
|
|
1376
|
-
canPersist,
|
|
1377
|
-
true,
|
|
1378
|
-
undefined,
|
|
1379
|
-
undefined,
|
|
1380
|
-
undefined,
|
|
1381
|
-
accessTypes,
|
|
1382
|
-
accessType,
|
|
1383
|
-
id
|
|
1384
|
-
));
|
|
1385
|
-
this.dataBreakpoints.push(newDataBreakpoint);
|
|
1386
|
-
this._onDidChangeBreakpoints.fire({ added: [newDataBreakpoint], sessionOnly: false });
|
|
1387
|
-
}
|
|
1388
|
-
updateDataBreakpoint(id, update) {
|
|
1389
|
-
const dataBreakpoint = this.dataBreakpoints.find(fbp => fbp.getId() === id);
|
|
1390
|
-
if (dataBreakpoint) {
|
|
1391
|
-
if (typeof update.condition === 'string') {
|
|
1392
|
-
dataBreakpoint.condition = update.condition;
|
|
1393
|
-
}
|
|
1394
|
-
if (typeof update.hitCondition === 'string') {
|
|
1395
|
-
dataBreakpoint.hitCondition = update.hitCondition;
|
|
1396
|
-
}
|
|
1397
|
-
this._onDidChangeBreakpoints.fire({ changed: [dataBreakpoint], sessionOnly: false });
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
removeDataBreakpoints(id) {
|
|
1401
|
-
let removed;
|
|
1402
|
-
if (id) {
|
|
1403
|
-
removed = this.dataBreakpoints.filter(fbp => fbp.getId() === id);
|
|
1404
|
-
this.dataBreakpoints = this.dataBreakpoints.filter(fbp => fbp.getId() !== id);
|
|
1405
|
-
}
|
|
1406
|
-
else {
|
|
1407
|
-
removed = this.dataBreakpoints;
|
|
1408
|
-
this.dataBreakpoints = [];
|
|
1409
|
-
}
|
|
1410
|
-
this._onDidChangeBreakpoints.fire({ removed, sessionOnly: false });
|
|
1411
|
-
}
|
|
1412
|
-
addInstructionBreakpoint(instructionReference, offset, address, condition, hitCondition) {
|
|
1413
|
-
const newInstructionBreakpoint = ( new InstructionBreakpoint(
|
|
1414
|
-
instructionReference,
|
|
1415
|
-
offset,
|
|
1416
|
-
false,
|
|
1417
|
-
true,
|
|
1418
|
-
hitCondition,
|
|
1419
|
-
condition,
|
|
1420
|
-
undefined,
|
|
1421
|
-
address
|
|
1422
|
-
));
|
|
1423
|
-
this.instructionBreakpoints.push(newInstructionBreakpoint);
|
|
1424
|
-
this._onDidChangeBreakpoints.fire({ added: [newInstructionBreakpoint], sessionOnly: true });
|
|
1425
|
-
}
|
|
1426
|
-
removeInstructionBreakpoints(instructionReference, offset) {
|
|
1427
|
-
let removed = [];
|
|
1428
|
-
if (instructionReference) {
|
|
1429
|
-
for (let i = 0; i < this.instructionBreakpoints.length; i++) {
|
|
1430
|
-
const ibp = this.instructionBreakpoints[i];
|
|
1431
|
-
if (ibp.instructionReference === instructionReference && (offset === undefined || ibp.offset === offset)) {
|
|
1432
|
-
removed.push(ibp);
|
|
1433
|
-
this.instructionBreakpoints.splice(i--, 1);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
else {
|
|
1438
|
-
removed = this.instructionBreakpoints;
|
|
1439
|
-
this.instructionBreakpoints = [];
|
|
1440
|
-
}
|
|
1441
|
-
this._onDidChangeBreakpoints.fire({ removed, sessionOnly: false });
|
|
1442
|
-
}
|
|
1443
|
-
getWatchExpressions() {
|
|
1444
|
-
return this.watchExpressions;
|
|
1445
|
-
}
|
|
1446
|
-
addWatchExpression(name) {
|
|
1447
|
-
const we = ( new Expression(name || ''));
|
|
1448
|
-
this.watchExpressions.push(we);
|
|
1449
|
-
this._onDidChangeWatchExpressions.fire(we);
|
|
1450
|
-
return we;
|
|
1451
|
-
}
|
|
1452
|
-
renameWatchExpression(id, newName) {
|
|
1453
|
-
const filtered = this.watchExpressions.filter(we => we.getId() === id);
|
|
1454
|
-
if (filtered.length === 1) {
|
|
1455
|
-
filtered[0].name = newName;
|
|
1456
|
-
this._onDidChangeWatchExpressions.fire(filtered[0]);
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
removeWatchExpressions(id = null) {
|
|
1460
|
-
this.watchExpressions = id ? this.watchExpressions.filter(we => we.getId() !== id) : [];
|
|
1461
|
-
this._onDidChangeWatchExpressions.fire(undefined);
|
|
1462
|
-
}
|
|
1463
|
-
moveWatchExpression(id, position) {
|
|
1464
|
-
const we = this.watchExpressions.find(we => we.getId() === id);
|
|
1465
|
-
if (we) {
|
|
1466
|
-
this.watchExpressions = this.watchExpressions.filter(we => we.getId() !== id);
|
|
1467
|
-
this.watchExpressions = this.watchExpressions.slice(0, position).concat(we, this.watchExpressions.slice(position));
|
|
1468
|
-
this._onDidChangeWatchExpressions.fire(undefined);
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
sourceIsNotAvailable(uri) {
|
|
1472
|
-
this.sessions.forEach(s => {
|
|
1473
|
-
const source = s.getSourceForUri(uri);
|
|
1474
|
-
if (source) {
|
|
1475
|
-
source.available = false;
|
|
1476
|
-
}
|
|
1477
|
-
});
|
|
1478
|
-
this._onDidChangeCallStack.fire(undefined);
|
|
1479
|
-
}
|
|
1480
|
-
};
|
|
1481
|
-
DebugModel = ( __decorate([
|
|
1482
|
-
( __param(1, ITextFileService)),
|
|
1483
|
-
( __param(2, IUriIdentityService)),
|
|
1484
|
-
( __param(3, ILogService))
|
|
1485
|
-
], DebugModel));
|
|
1486
|
-
|
|
1487
|
-
export { BaseBreakpoint, Breakpoint, DataBreakpoint, DebugModel, Enablement, ErrorScope, ExceptionBreakpoint, Expression, ExpressionContainer, FunctionBreakpoint, InstructionBreakpoint, MemoryRegion, Scope, StackFrame, Thread, ThreadAndSessionIds, Variable, getUriForDebugMemory };
|