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