@codingame/monaco-vscode-debug-service-override 3.2.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/debug.js +4 -4
  2. package/package.json +2 -2
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  6. package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +0 -73
  7. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +0 -1011
  8. package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +0 -970
  9. package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +0 -347
  10. package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +0 -324
  11. package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +0 -432
  12. package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +0 -1039
  13. package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +0 -649
  14. package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +0 -64
  15. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +0 -636
  16. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +0 -725
  17. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +0 -398
  18. package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +0 -206
  19. package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +0 -80
  20. package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +0 -169
  21. package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +0 -1271
  22. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +0 -1305
  23. package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +0 -115
  24. package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +0 -77
  25. package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +0 -307
  26. package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +0 -31
  27. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +0 -378
  28. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +0 -267
  29. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +0 -808
  30. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +0 -121
  31. package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +0 -141
  32. package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +0 -262
  33. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +0 -669
  34. package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +0 -6
  35. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +0 -6
  36. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +0 -6
  37. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +0 -6
  38. package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +0 -6
  39. package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +0 -6
  40. package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +0 -709
  41. package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +0 -992
  42. package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +0 -48
  43. package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +0 -348
  44. package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +0 -119
  45. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +0 -763
  46. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +0 -501
  47. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +0 -162
  48. package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +0 -21
  49. package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +0 -17
  50. package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +0 -110
  51. package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +0 -62
  52. package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +0 -460
  53. package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +0 -162
  54. package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +0 -36
  55. package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +0 -148
  56. package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +0 -289
  57. package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +0 -87
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +0 -64
  59. package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +0 -311
  60. package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +0 -28
@@ -1,808 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { PixelRatio } from 'vscode/vscode/vs/base/browser/pixelRatio';
3
- import { getWindowById, append, $, addStandardDisposableListener } from 'vscode/vscode/vs/base/browser/dom';
4
- import { binarySearch2 } from 'vscode/vscode/vs/base/common/arrays';
5
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
6
- import { dispose, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
7
- import { isAbsolute } from 'vscode/vscode/vs/base/common/path';
8
- import { URI } from 'vscode/vscode/vs/base/common/uri';
9
- import { applyFontInfo } from 'vscode/vscode/vs/editor/browser/config/domFontInfo';
10
- import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
11
- import { BareFontInfo } from 'vscode/vscode/vs/editor/common/config/fontInfo';
12
- import { Range } from 'vscode/vscode/vs/editor/common/core/range';
13
- import { StringBuilder } from 'vscode/vscode/vs/editor/common/core/stringBuilder';
14
- import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
15
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
16
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
17
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
18
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
19
- import { WorkbenchTable } from 'vscode/vscode/vs/platform/list/browser/listService';
20
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
21
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
22
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
23
- import { editorBackground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
24
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
25
- import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
26
- import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
27
- import { topStackFrameColor, focusedStackFrameColor } from 'vscode/vscode/vs/workbench/contrib/debug/browser/callStackEditorContribution';
28
- import { breakpoint, debugBreakpointHint, debugStackframe, debugStackframeFocused } from 'vscode/vscode/vs/workbench/contrib/debug/browser/debugIcons';
29
- import { DISASSEMBLY_VIEW_ID, CONTEXT_LANGUAGE_SUPPORTS_DISASSEMBLE_REQUEST, IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
30
- import { InstructionBreakpoint } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
31
- import { getUriFromSource } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugSource';
32
- import { isUri, sourcesEqual } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugUtils';
33
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
34
-
35
- var DisassemblyView_1, BreakpointRenderer_1, InstructionRenderer_1;
36
- const disassemblyNotAvailable = {
37
- allowBreakpoint: false,
38
- isBreakpointSet: false,
39
- isBreakpointEnabled: false,
40
- instructionReference: '',
41
- instructionOffset: 0,
42
- instructionReferenceOffset: 0,
43
- address: 0n,
44
- instruction: {
45
- address: '-1',
46
- instruction: ( localizeWithPath(
47
- 'vs/workbench/contrib/debug/browser/disassemblyView',
48
- 'instructionNotAvailable',
49
- "Disassembly not available."
50
- ))
51
- },
52
- };
53
- let DisassemblyView = class DisassemblyView extends EditorPane {
54
- static { DisassemblyView_1 = this; }
55
- static { this.NUM_INSTRUCTIONS_TO_LOAD = 50; }
56
- constructor(telemetryService, themeService, storageService, _configurationService, _instantiationService, _debugService) {
57
- super(DISASSEMBLY_VIEW_ID, telemetryService, themeService, storageService);
58
- this._configurationService = _configurationService;
59
- this._instantiationService = _instantiationService;
60
- this._debugService = _debugService;
61
- this._instructionBpList = [];
62
- this._enableSourceCodeRender = true;
63
- this._loadingLock = false;
64
- this._referenceToMemoryAddress = ( new Map());
65
- this._disassembledInstructions = undefined;
66
- this._onDidChangeStackFrame = this._register(( new Emitter({ leakWarningThreshold: 1000 })));
67
- this._previousDebuggingState = _debugService.state;
68
- this._register(_configurationService.onDidChangeConfiguration(e => {
69
- if (e.affectsConfiguration('debug')) {
70
- const newValue = this._configurationService.getValue('debug').disassemblyView.showSourceCode;
71
- if (this._enableSourceCodeRender !== newValue) {
72
- this._enableSourceCodeRender = newValue;
73
- }
74
- else {
75
- this._disassembledInstructions?.rerender();
76
- }
77
- }
78
- }));
79
- }
80
- get fontInfo() {
81
- if (!this._fontInfo) {
82
- this._fontInfo = this.createFontInfo();
83
- this._register(this._configurationService.onDidChangeConfiguration(e => {
84
- if (e.affectsConfiguration('editor')) {
85
- this._fontInfo = this.createFontInfo();
86
- }
87
- }));
88
- }
89
- return this._fontInfo;
90
- }
91
- createFontInfo() {
92
- const window = getWindowById(this.group?.windowId, true).window;
93
- return BareFontInfo.createFromRawSettings(this._configurationService.getValue('editor'), PixelRatio.getInstance(window).value);
94
- }
95
- get currentInstructionAddresses() {
96
- return ( ( ( ( this._debugService.getModel().getSessions(false).
97
- map(session => session.getAllThreads())).
98
- reduce((prev, curr) => prev.concat(curr), []).
99
- map(thread => thread.getTopStackFrame())).
100
- map(frame => frame?.instructionPointerReference)).
101
- map(ref => ref ? this.getReferenceAddress(ref) : undefined));
102
- }
103
- get focusedCurrentInstructionReference() {
104
- return this._debugService.getViewModel().focusedStackFrame?.thread.getTopStackFrame()?.instructionPointerReference;
105
- }
106
- get focusedCurrentInstructionAddress() {
107
- const ref = this.focusedCurrentInstructionReference;
108
- return ref ? this.getReferenceAddress(ref) : undefined;
109
- }
110
- get focusedInstructionReference() {
111
- return this._debugService.getViewModel().focusedStackFrame?.instructionPointerReference;
112
- }
113
- get focusedInstructionAddress() {
114
- const ref = this.focusedInstructionReference;
115
- return ref ? this.getReferenceAddress(ref) : undefined;
116
- }
117
- get isSourceCodeRender() { return this._enableSourceCodeRender; }
118
- get debugSession() {
119
- return this._debugService.getViewModel().focusedSession;
120
- }
121
- get onDidChangeStackFrame() { return this._onDidChangeStackFrame.event; }
122
- get focusedAddressAndOffset() {
123
- const element = this._disassembledInstructions?.getFocusedElements()[0];
124
- if (!element) {
125
- return undefined;
126
- }
127
- const reference = element.instructionReference;
128
- const offset = Number(element.address - this.getReferenceAddress(reference));
129
- return { reference, offset, address: element.address };
130
- }
131
- createEditor(parent) {
132
- this._enableSourceCodeRender = this._configurationService.getValue('debug').disassemblyView.showSourceCode;
133
- const lineHeight = this.fontInfo.lineHeight;
134
- const thisOM = this;
135
- const delegate = new class {
136
- constructor() {
137
- this.headerRowHeight = 0;
138
- }
139
- getHeight(row) {
140
- if (thisOM.isSourceCodeRender && row.showSourceLocation && row.instruction.location?.path && row.instruction.line) {
141
- if (row.instruction.endLine) {
142
- return lineHeight * (row.instruction.endLine - row.instruction.line + 2);
143
- }
144
- else {
145
- return lineHeight * 2;
146
- }
147
- }
148
- return lineHeight;
149
- }
150
- };
151
- const instructionRenderer = this._register(this._instantiationService.createInstance(InstructionRenderer, this));
152
- this._disassembledInstructions = this._register(this._instantiationService.createInstance(WorkbenchTable, 'DisassemblyView', parent, delegate, [
153
- {
154
- label: '',
155
- tooltip: '',
156
- weight: 0,
157
- minimumWidth: this.fontInfo.lineHeight,
158
- maximumWidth: this.fontInfo.lineHeight,
159
- templateId: BreakpointRenderer.TEMPLATE_ID,
160
- project(row) { return row; }
161
- },
162
- {
163
- label: ( localizeWithPath(
164
- 'vs/workbench/contrib/debug/browser/disassemblyView',
165
- 'disassemblyTableColumnLabel',
166
- "instructions"
167
- )),
168
- tooltip: '',
169
- weight: 0.3,
170
- templateId: InstructionRenderer.TEMPLATE_ID,
171
- project(row) { return row; }
172
- },
173
- ], [
174
- this._instantiationService.createInstance(BreakpointRenderer, this),
175
- instructionRenderer,
176
- ], {
177
- identityProvider: { getId: (e) => e.instruction.address },
178
- horizontalScrolling: false,
179
- overrideStyles: {
180
- listBackground: editorBackground
181
- },
182
- multipleSelectionSupport: false,
183
- setRowLineHeight: false,
184
- openOnSingleClick: false,
185
- accessibilityProvider: ( new AccessibilityProvider()),
186
- mouseSupport: false
187
- }));
188
- if (this.focusedInstructionReference) {
189
- this.reloadDisassembly(this.focusedInstructionReference, 0);
190
- }
191
- this._register(this._disassembledInstructions.onDidScroll(e => {
192
- if (this._loadingLock) {
193
- return;
194
- }
195
- if (e.oldScrollTop > e.scrollTop && e.scrollTop < e.height) {
196
- this._loadingLock = true;
197
- const prevTop = Math.floor(e.scrollTop / this.fontInfo.lineHeight);
198
- this.scrollUp_LoadDisassembledInstructions(DisassemblyView_1.NUM_INSTRUCTIONS_TO_LOAD).then((loaded) => {
199
- if (loaded > 0) {
200
- this._disassembledInstructions.reveal(prevTop + loaded, 0);
201
- }
202
- this._loadingLock = false;
203
- });
204
- }
205
- else if (e.oldScrollTop < e.scrollTop && e.scrollTop + e.height > e.scrollHeight - e.height) {
206
- this._loadingLock = true;
207
- this.scrollDown_LoadDisassembledInstructions(DisassemblyView_1.NUM_INSTRUCTIONS_TO_LOAD).then(() => { this._loadingLock = false; });
208
- }
209
- }));
210
- this._register(this._debugService.getViewModel().onDidFocusStackFrame(({ stackFrame }) => {
211
- if (this._disassembledInstructions && stackFrame?.instructionPointerReference) {
212
- this.goToInstructionAndOffset(stackFrame.instructionPointerReference, 0);
213
- }
214
- this._onDidChangeStackFrame.fire();
215
- }));
216
- this._register(this._debugService.getModel().onDidChangeBreakpoints(bpEvent => {
217
- if (bpEvent && this._disassembledInstructions) {
218
- let changed = false;
219
- bpEvent.added?.forEach((bp) => {
220
- if (bp instanceof InstructionBreakpoint) {
221
- const index = this.getIndexFromReferenceAndOffset(bp.instructionReference, bp.offset);
222
- if (index >= 0) {
223
- this._disassembledInstructions.row(index).isBreakpointSet = true;
224
- this._disassembledInstructions.row(index).isBreakpointEnabled = bp.enabled;
225
- changed = true;
226
- }
227
- }
228
- });
229
- bpEvent.removed?.forEach((bp) => {
230
- if (bp instanceof InstructionBreakpoint) {
231
- const index = this.getIndexFromReferenceAndOffset(bp.instructionReference, bp.offset);
232
- if (index >= 0) {
233
- this._disassembledInstructions.row(index).isBreakpointSet = false;
234
- changed = true;
235
- }
236
- }
237
- });
238
- bpEvent.changed?.forEach((bp) => {
239
- if (bp instanceof InstructionBreakpoint) {
240
- const index = this.getIndexFromReferenceAndOffset(bp.instructionReference, bp.offset);
241
- if (index >= 0) {
242
- if (this._disassembledInstructions.row(index).isBreakpointEnabled !== bp.enabled) {
243
- this._disassembledInstructions.row(index).isBreakpointEnabled = bp.enabled;
244
- changed = true;
245
- }
246
- }
247
- }
248
- });
249
- this._instructionBpList = this._debugService.getModel().getInstructionBreakpoints();
250
- for (const bp of this._instructionBpList) {
251
- this.primeMemoryReference(bp.instructionReference);
252
- }
253
- if (changed) {
254
- this._onDidChangeStackFrame.fire();
255
- }
256
- }
257
- }));
258
- this._register(this._debugService.onDidChangeState(e => {
259
- if (((e === 3 || e === 2) ) &&
260
- ((this._previousDebuggingState !== 3 && this._previousDebuggingState !== 2) )) {
261
- this.clear();
262
- this._enableSourceCodeRender = this._configurationService.getValue('debug').disassemblyView.showSourceCode;
263
- }
264
- this._previousDebuggingState = e;
265
- this._onDidChangeStackFrame.fire();
266
- }));
267
- }
268
- layout(dimension) {
269
- this._disassembledInstructions?.layout(dimension.height);
270
- }
271
- async goToInstructionAndOffset(instructionReference, offset, focus) {
272
- let addr = this._referenceToMemoryAddress.get(instructionReference);
273
- if (addr === undefined) {
274
- await this.loadDisassembledInstructions(instructionReference, 0, -DisassemblyView_1.NUM_INSTRUCTIONS_TO_LOAD, DisassemblyView_1.NUM_INSTRUCTIONS_TO_LOAD * 2);
275
- addr = this._referenceToMemoryAddress.get(instructionReference);
276
- }
277
- if (addr) {
278
- this.goToAddress(addr + BigInt(offset), focus);
279
- }
280
- }
281
- getReferenceAddress(instructionReference) {
282
- return this._referenceToMemoryAddress.get(instructionReference);
283
- }
284
- goToAddress(address, focus) {
285
- if (!this._disassembledInstructions) {
286
- return false;
287
- }
288
- if (!address) {
289
- return false;
290
- }
291
- const index = this.getIndexFromAddress(address);
292
- if (index >= 0) {
293
- this._disassembledInstructions.reveal(index);
294
- if (focus) {
295
- this._disassembledInstructions.domFocus();
296
- this._disassembledInstructions.setFocus([index]);
297
- }
298
- return true;
299
- }
300
- return false;
301
- }
302
- async scrollUp_LoadDisassembledInstructions(instructionCount) {
303
- const first = this._disassembledInstructions?.row(0);
304
- if (first) {
305
- return this.loadDisassembledInstructions(first.instructionReference, first.instructionReferenceOffset, first.instructionOffset - instructionCount, instructionCount);
306
- }
307
- return 0;
308
- }
309
- async scrollDown_LoadDisassembledInstructions(instructionCount) {
310
- const last = this._disassembledInstructions?.row(this._disassembledInstructions?.length - 1);
311
- if (last) {
312
- return this.loadDisassembledInstructions(last.instructionReference, last.instructionReferenceOffset, last.instructionOffset + 1, instructionCount);
313
- }
314
- return 0;
315
- }
316
- async primeMemoryReference(instructionReference) {
317
- if (( this._referenceToMemoryAddress.has(instructionReference))) {
318
- return true;
319
- }
320
- const s = await this.debugSession?.disassemble(instructionReference, 0, 0, 1);
321
- if (s && s.length > 0) {
322
- try {
323
- this._referenceToMemoryAddress.set(instructionReference, BigInt(s[0].address));
324
- return true;
325
- }
326
- catch {
327
- return false;
328
- }
329
- }
330
- return false;
331
- }
332
- async loadDisassembledInstructions(instructionReference, offset, instructionOffset, instructionCount) {
333
- const session = this.debugSession;
334
- const resultEntries = await session?.disassemble(instructionReference, offset, instructionOffset, instructionCount);
335
- if (!( this._referenceToMemoryAddress.has(instructionReference)) && instructionOffset !== 0) {
336
- await this.loadDisassembledInstructions(instructionReference, 0, 0, DisassemblyView_1.NUM_INSTRUCTIONS_TO_LOAD);
337
- }
338
- if (session && resultEntries && this._disassembledInstructions) {
339
- const newEntries = [];
340
- let lastLocation;
341
- let lastLine;
342
- for (let i = 0; i < resultEntries.length; i++) {
343
- const instruction = resultEntries[i];
344
- const thisInstructionOffset = instructionOffset + i;
345
- if (instruction.location) {
346
- lastLocation = instruction.location;
347
- lastLine = undefined;
348
- }
349
- if (instruction.line) {
350
- const currentLine = {
351
- startLineNumber: instruction.line,
352
- startColumn: instruction.column ?? 0,
353
- endLineNumber: instruction.endLine ?? instruction.line,
354
- endColumn: instruction.endColumn ?? 0,
355
- };
356
- if (!Range.equalsRange(currentLine, lastLine ?? null)) {
357
- lastLine = currentLine;
358
- instruction.location = lastLocation;
359
- }
360
- }
361
- let address;
362
- try {
363
- address = BigInt(instruction.address);
364
- }
365
- catch {
366
- console.error(`Could not parse disassembly address ${instruction.address} (in ${JSON.stringify(instruction)})`);
367
- continue;
368
- }
369
- const entry = {
370
- allowBreakpoint: true,
371
- isBreakpointSet: false,
372
- isBreakpointEnabled: false,
373
- instructionReference,
374
- instructionReferenceOffset: offset,
375
- instructionOffset: thisInstructionOffset,
376
- instruction,
377
- address,
378
- };
379
- newEntries.push(entry);
380
- if (offset === 0 && thisInstructionOffset === 0) {
381
- this._referenceToMemoryAddress.set(instructionReference, address);
382
- }
383
- }
384
- if (newEntries.length === 0) {
385
- return 0;
386
- }
387
- const refBaseAddress = this._referenceToMemoryAddress.get(instructionReference);
388
- const bps = ( this._instructionBpList.map(p => {
389
- const base = this._referenceToMemoryAddress.get(p.instructionReference);
390
- if (!base) {
391
- return undefined;
392
- }
393
- return {
394
- enabled: p.enabled,
395
- address: base + BigInt(p.offset || 0),
396
- };
397
- }));
398
- if (refBaseAddress !== undefined) {
399
- for (const entry of newEntries) {
400
- const bp = bps.find(p => p?.address === entry.address);
401
- if (bp) {
402
- entry.isBreakpointSet = true;
403
- entry.isBreakpointEnabled = bp.enabled;
404
- }
405
- }
406
- }
407
- const da = this._disassembledInstructions;
408
- if (da.length === 1 && this._disassembledInstructions.row(0) === disassemblyNotAvailable) {
409
- da.splice(0, 1);
410
- }
411
- const firstAddr = newEntries[0].address;
412
- const lastAddr = newEntries[newEntries.length - 1].address;
413
- const startN = binarySearch2(da.length, i => Number(da.row(i).address - firstAddr));
414
- const start = startN < 0 ? ~startN : startN;
415
- const endN = binarySearch2(da.length, i => Number(da.row(i).address - lastAddr));
416
- const end = endN < 0 ? ~endN : endN + 1;
417
- const toDelete = end - start;
418
- let lastLocated;
419
- for (let i = start - 1; i >= 0; i--) {
420
- const { instruction } = da.row(i);
421
- if (instruction.location && instruction.line !== undefined) {
422
- lastLocated = instruction;
423
- break;
424
- }
425
- }
426
- const shouldShowLocation = (instruction) => instruction.line !== undefined && instruction.location !== undefined &&
427
- (!lastLocated || !sourcesEqual(instruction.location, lastLocated.location) || instruction.line !== lastLocated.line);
428
- for (const entry of newEntries) {
429
- if (shouldShowLocation(entry.instruction)) {
430
- entry.showSourceLocation = true;
431
- lastLocated = entry.instruction;
432
- }
433
- }
434
- da.splice(start, toDelete, newEntries);
435
- return newEntries.length - toDelete;
436
- }
437
- return 0;
438
- }
439
- getIndexFromReferenceAndOffset(instructionReference, offset) {
440
- const addr = this._referenceToMemoryAddress.get(instructionReference);
441
- if (addr === undefined) {
442
- return -1;
443
- }
444
- return this.getIndexFromAddress(addr + BigInt(offset));
445
- }
446
- getIndexFromAddress(address) {
447
- const disassembledInstructions = this._disassembledInstructions;
448
- if (disassembledInstructions && disassembledInstructions.length > 0) {
449
- return binarySearch2(disassembledInstructions.length, index => {
450
- const row = disassembledInstructions.row(index);
451
- return Number(row.address - address);
452
- });
453
- }
454
- return -1;
455
- }
456
- reloadDisassembly(instructionReference, offset) {
457
- if (!this._disassembledInstructions) {
458
- return;
459
- }
460
- this._loadingLock = true;
461
- this.clear();
462
- this._instructionBpList = this._debugService.getModel().getInstructionBreakpoints();
463
- this.loadDisassembledInstructions(instructionReference, offset, -DisassemblyView_1.NUM_INSTRUCTIONS_TO_LOAD * 4, DisassemblyView_1.NUM_INSTRUCTIONS_TO_LOAD * 8).then(() => {
464
- if (this._disassembledInstructions.length > 0) {
465
- const targetIndex = Math.floor(this._disassembledInstructions.length / 2);
466
- this._disassembledInstructions.reveal(targetIndex, 0.5);
467
- this._disassembledInstructions.domFocus();
468
- this._disassembledInstructions.setFocus([targetIndex]);
469
- }
470
- this._loadingLock = false;
471
- });
472
- }
473
- clear() {
474
- this._referenceToMemoryAddress.clear();
475
- this._disassembledInstructions?.splice(0, this._disassembledInstructions.length, [disassemblyNotAvailable]);
476
- }
477
- };
478
- DisassemblyView = DisassemblyView_1 = ( __decorate([
479
- ( __param(0, ITelemetryService)),
480
- ( __param(1, IThemeService)),
481
- ( __param(2, IStorageService)),
482
- ( __param(3, IConfigurationService)),
483
- ( __param(4, IInstantiationService)),
484
- ( __param(5, IDebugService))
485
- ], DisassemblyView));
486
- let BreakpointRenderer = class BreakpointRenderer {
487
- static { BreakpointRenderer_1 = this; }
488
- static { this.TEMPLATE_ID = 'breakpoint'; }
489
- constructor(_disassemblyView, _debugService) {
490
- this._disassemblyView = _disassemblyView;
491
- this._debugService = _debugService;
492
- this.templateId = BreakpointRenderer_1.TEMPLATE_ID;
493
- this._breakpointIcon = 'codicon-' + breakpoint.regular.id;
494
- this._breakpointDisabledIcon = 'codicon-' + breakpoint.disabled.id;
495
- this._breakpointHintIcon = 'codicon-' + debugBreakpointHint.id;
496
- this._debugStackframe = 'codicon-' + debugStackframe.id;
497
- this._debugStackframeFocused = 'codicon-' + debugStackframeFocused.id;
498
- }
499
- renderTemplate(container) {
500
- container.style.alignSelf = 'flex-end';
501
- const icon = append(container, $('.disassembly-view'));
502
- icon.classList.add('codicon');
503
- icon.style.display = 'flex';
504
- icon.style.alignItems = 'center';
505
- icon.style.justifyContent = 'center';
506
- icon.style.height = this._disassemblyView.fontInfo.lineHeight + 'px';
507
- const currentElement = { element: undefined };
508
- const disposables = [
509
- this._disassemblyView.onDidChangeStackFrame(() => this.rerenderDebugStackframe(icon, currentElement.element)),
510
- addStandardDisposableListener(container, 'mouseover', () => {
511
- if (currentElement.element?.allowBreakpoint) {
512
- icon.classList.add(this._breakpointHintIcon);
513
- }
514
- }),
515
- addStandardDisposableListener(container, 'mouseout', () => {
516
- if (currentElement.element?.allowBreakpoint) {
517
- icon.classList.remove(this._breakpointHintIcon);
518
- }
519
- }),
520
- addStandardDisposableListener(container, 'click', () => {
521
- if (currentElement.element?.allowBreakpoint) {
522
- icon.classList.add(this._breakpointHintIcon);
523
- const reference = currentElement.element.instructionReference;
524
- const offset = Number(currentElement.element.address - this._disassemblyView.getReferenceAddress(reference));
525
- if (currentElement.element.isBreakpointSet) {
526
- this._debugService.removeInstructionBreakpoints(reference, offset);
527
- }
528
- else if (currentElement.element.allowBreakpoint && !currentElement.element.isBreakpointSet) {
529
- this._debugService.addInstructionBreakpoint({ instructionReference: reference, offset, address: currentElement.element.address, canPersist: false });
530
- }
531
- }
532
- })
533
- ];
534
- return { currentElement, icon, disposables };
535
- }
536
- renderElement(element, index, templateData, height) {
537
- templateData.currentElement.element = element;
538
- this.rerenderDebugStackframe(templateData.icon, element);
539
- }
540
- disposeTemplate(templateData) {
541
- dispose(templateData.disposables);
542
- templateData.disposables = [];
543
- }
544
- rerenderDebugStackframe(icon, element) {
545
- if (element?.address === this._disassemblyView.focusedCurrentInstructionAddress) {
546
- icon.classList.add(this._debugStackframe);
547
- }
548
- else if (element?.address === this._disassemblyView.focusedInstructionAddress) {
549
- icon.classList.add(this._debugStackframeFocused);
550
- }
551
- else {
552
- icon.classList.remove(this._debugStackframe);
553
- icon.classList.remove(this._debugStackframeFocused);
554
- }
555
- icon.classList.remove(this._breakpointHintIcon);
556
- if (element?.isBreakpointSet) {
557
- if (element.isBreakpointEnabled) {
558
- icon.classList.add(this._breakpointIcon);
559
- icon.classList.remove(this._breakpointDisabledIcon);
560
- }
561
- else {
562
- icon.classList.remove(this._breakpointIcon);
563
- icon.classList.add(this._breakpointDisabledIcon);
564
- }
565
- }
566
- else {
567
- icon.classList.remove(this._breakpointIcon);
568
- icon.classList.remove(this._breakpointDisabledIcon);
569
- }
570
- }
571
- };
572
- BreakpointRenderer = BreakpointRenderer_1 = ( __decorate([
573
- ( __param(1, IDebugService))
574
- ], BreakpointRenderer));
575
- let InstructionRenderer = class InstructionRenderer extends Disposable {
576
- static { InstructionRenderer_1 = this; }
577
- static { this.TEMPLATE_ID = 'instruction'; }
578
- static { this.INSTRUCTION_ADDR_MIN_LENGTH = 25; }
579
- static { this.INSTRUCTION_BYTES_MIN_LENGTH = 30; }
580
- constructor(_disassemblyView, themeService, editorService, textModelService, uriService, logService) {
581
- super();
582
- this._disassemblyView = _disassemblyView;
583
- this.editorService = editorService;
584
- this.textModelService = textModelService;
585
- this.uriService = uriService;
586
- this.logService = logService;
587
- this.templateId = InstructionRenderer_1.TEMPLATE_ID;
588
- this._topStackFrameColor = themeService.getColorTheme().getColor(topStackFrameColor);
589
- this._focusedStackFrameColor = themeService.getColorTheme().getColor(focusedStackFrameColor);
590
- this._register(themeService.onDidColorThemeChange(e => {
591
- this._topStackFrameColor = e.getColor(topStackFrameColor);
592
- this._focusedStackFrameColor = e.getColor(focusedStackFrameColor);
593
- }));
594
- }
595
- renderTemplate(container) {
596
- const sourcecode = append(container, $('.sourcecode'));
597
- const instruction = append(container, $('.instruction'));
598
- this.applyFontInfo(sourcecode);
599
- this.applyFontInfo(instruction);
600
- const currentElement = { element: undefined };
601
- const cellDisposable = [];
602
- const disposables = [
603
- this._disassemblyView.onDidChangeStackFrame(() => this.rerenderBackground(instruction, sourcecode, currentElement.element)),
604
- addStandardDisposableListener(sourcecode, 'dblclick', () => this.openSourceCode(currentElement.element?.instruction)),
605
- ];
606
- return { currentElement, instruction, sourcecode, cellDisposable, disposables };
607
- }
608
- renderElement(element, index, templateData, height) {
609
- this.renderElementInner(element, index, templateData, height);
610
- }
611
- async renderElementInner(element, index, templateData, height) {
612
- templateData.currentElement.element = element;
613
- const instruction = element.instruction;
614
- templateData.sourcecode.innerText = '';
615
- const sb = ( new StringBuilder(1000));
616
- if (this._disassemblyView.isSourceCodeRender && element.showSourceLocation && instruction.location?.path && instruction.line !== undefined) {
617
- const sourceURI = this.getUriFromSource(instruction);
618
- if (sourceURI) {
619
- let textModel = undefined;
620
- const sourceSB = ( new StringBuilder(10000));
621
- const ref = await this.textModelService.createModelReference(sourceURI);
622
- if (templateData.currentElement.element !== element) {
623
- return;
624
- }
625
- textModel = ref.object.textEditorModel;
626
- templateData.cellDisposable.push(ref);
627
- if (textModel && templateData.currentElement.element === element) {
628
- let lineNumber = instruction.line;
629
- while (lineNumber && lineNumber >= 1 && lineNumber <= textModel.getLineCount()) {
630
- const lineContent = textModel.getLineContent(lineNumber);
631
- sourceSB.appendString(` ${lineNumber}: `);
632
- sourceSB.appendString(lineContent + '\n');
633
- if (instruction.endLine && lineNumber < instruction.endLine) {
634
- lineNumber++;
635
- continue;
636
- }
637
- break;
638
- }
639
- templateData.sourcecode.innerText = sourceSB.build();
640
- }
641
- }
642
- }
643
- let spacesToAppend = 10;
644
- if (instruction.address !== '-1') {
645
- sb.appendString(instruction.address);
646
- if (instruction.address.length < InstructionRenderer_1.INSTRUCTION_ADDR_MIN_LENGTH) {
647
- spacesToAppend = InstructionRenderer_1.INSTRUCTION_ADDR_MIN_LENGTH - instruction.address.length;
648
- }
649
- for (let i = 0; i < spacesToAppend; i++) {
650
- sb.appendString(' ');
651
- }
652
- }
653
- if (instruction.instructionBytes) {
654
- sb.appendString(instruction.instructionBytes);
655
- spacesToAppend = 10;
656
- if (instruction.instructionBytes.length < InstructionRenderer_1.INSTRUCTION_BYTES_MIN_LENGTH) {
657
- spacesToAppend = InstructionRenderer_1.INSTRUCTION_BYTES_MIN_LENGTH - instruction.instructionBytes.length;
658
- }
659
- for (let i = 0; i < spacesToAppend; i++) {
660
- sb.appendString(' ');
661
- }
662
- }
663
- sb.appendString(instruction.instruction);
664
- templateData.instruction.innerText = sb.build();
665
- this.rerenderBackground(templateData.instruction, templateData.sourcecode, element);
666
- }
667
- disposeElement(element, index, templateData, height) {
668
- dispose(templateData.cellDisposable);
669
- templateData.cellDisposable = [];
670
- }
671
- disposeTemplate(templateData) {
672
- dispose(templateData.disposables);
673
- templateData.disposables = [];
674
- }
675
- rerenderBackground(instruction, sourceCode, element) {
676
- if (element && this._disassemblyView.currentInstructionAddresses.includes(element.address)) {
677
- instruction.style.background = this._topStackFrameColor?.toString() || 'transparent';
678
- }
679
- else if (element?.address === this._disassemblyView.focusedInstructionAddress) {
680
- instruction.style.background = this._focusedStackFrameColor?.toString() || 'transparent';
681
- }
682
- else {
683
- instruction.style.background = 'transparent';
684
- }
685
- }
686
- openSourceCode(instruction) {
687
- if (instruction) {
688
- const sourceURI = this.getUriFromSource(instruction);
689
- const selection = instruction.endLine ? {
690
- startLineNumber: instruction.line,
691
- endLineNumber: instruction.endLine,
692
- startColumn: instruction.column || 1,
693
- endColumn: instruction.endColumn || 1073741824 ,
694
- } : {
695
- startLineNumber: instruction.line,
696
- endLineNumber: instruction.line,
697
- startColumn: instruction.column || 1,
698
- endColumn: instruction.endColumn || 1073741824 ,
699
- };
700
- this.editorService.openEditor({
701
- resource: sourceURI,
702
- description: ( localizeWithPath(
703
- 'vs/workbench/contrib/debug/browser/disassemblyView',
704
- 'editorOpenedFromDisassemblyDescription',
705
- "from disassembly"
706
- )),
707
- options: {
708
- preserveFocus: false,
709
- selection: selection,
710
- revealIfOpened: true,
711
- selectionRevealType: 1 ,
712
- pinned: false,
713
- }
714
- });
715
- }
716
- }
717
- getUriFromSource(instruction) {
718
- const path = instruction.location.path;
719
- if (path && isUri(path)) {
720
- return this.uriService.asCanonicalUri(( URI.parse(path)));
721
- }
722
- if (path && isAbsolute(path)) {
723
- return this.uriService.asCanonicalUri(URI.file(path));
724
- }
725
- return getUriFromSource(instruction.location, instruction.location.path, this._disassemblyView.debugSession.getId(), this.uriService, this.logService);
726
- }
727
- applyFontInfo(element) {
728
- applyFontInfo(element, this._disassemblyView.fontInfo);
729
- element.style.whiteSpace = 'pre';
730
- }
731
- };
732
- InstructionRenderer = InstructionRenderer_1 = ( __decorate([
733
- ( __param(1, IThemeService)),
734
- ( __param(2, IEditorService)),
735
- ( __param(3, ITextModelService)),
736
- ( __param(4, IUriIdentityService)),
737
- ( __param(5, ILogService))
738
- ], InstructionRenderer));
739
- class AccessibilityProvider {
740
- getWidgetAriaLabel() {
741
- return ( localizeWithPath(
742
- 'vs/workbench/contrib/debug/browser/disassemblyView',
743
- 'disassemblyView',
744
- "Disassembly View"
745
- ));
746
- }
747
- getAriaLabel(element) {
748
- let label = '';
749
- const instruction = element.instruction;
750
- if (instruction.address !== '-1') {
751
- label += `${( localizeWithPath(
752
- 'vs/workbench/contrib/debug/browser/disassemblyView',
753
- 'instructionAddress',
754
- "Address"
755
- ))}: ${instruction.address}`;
756
- }
757
- if (instruction.instructionBytes) {
758
- label += `, ${( localizeWithPath(
759
- 'vs/workbench/contrib/debug/browser/disassemblyView',
760
- 'instructionBytes',
761
- "Bytes"
762
- ))}: ${instruction.instructionBytes}`;
763
- }
764
- label += `, ${( localizeWithPath(
765
- 'vs/workbench/contrib/debug/browser/disassemblyView',
766
- `instructionText`,
767
- "Instruction"
768
- ))}: ${instruction.instruction}`;
769
- return label;
770
- }
771
- }
772
- let DisassemblyViewContribution = class DisassemblyViewContribution {
773
- constructor(editorService, debugService, contextKeyService) {
774
- contextKeyService.bufferChangeEvents(() => {
775
- this._languageSupportsDisassembleRequest = CONTEXT_LANGUAGE_SUPPORTS_DISASSEMBLE_REQUEST.bindTo(contextKeyService);
776
- });
777
- const onDidActiveEditorChangeListener = () => {
778
- if (this._onDidChangeModelLanguage) {
779
- this._onDidChangeModelLanguage.dispose();
780
- this._onDidChangeModelLanguage = undefined;
781
- }
782
- const activeTextEditorControl = editorService.activeTextEditorControl;
783
- if (isCodeEditor(activeTextEditorControl)) {
784
- const language = activeTextEditorControl.getModel()?.getLanguageId();
785
- this._languageSupportsDisassembleRequest?.set(!!language && debugService.getAdapterManager().someDebuggerInterestedInLanguage(language));
786
- this._onDidChangeModelLanguage = activeTextEditorControl.onDidChangeModelLanguage(e => {
787
- this._languageSupportsDisassembleRequest?.set(debugService.getAdapterManager().someDebuggerInterestedInLanguage(e.newLanguage));
788
- });
789
- }
790
- else {
791
- this._languageSupportsDisassembleRequest?.set(false);
792
- }
793
- };
794
- onDidActiveEditorChangeListener();
795
- this._onDidActiveEditorChangeListener = editorService.onDidActiveEditorChange(onDidActiveEditorChangeListener);
796
- }
797
- dispose() {
798
- this._onDidActiveEditorChangeListener.dispose();
799
- this._onDidChangeModelLanguage?.dispose();
800
- }
801
- };
802
- DisassemblyViewContribution = ( __decorate([
803
- ( __param(0, IEditorService)),
804
- ( __param(1, IDebugService)),
805
- ( __param(2, IContextKeyService))
806
- ], DisassemblyViewContribution));
807
-
808
- export { DisassemblyView, DisassemblyViewContribution };