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