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