@theia/debug 1.70.0-next.81 → 1.70.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/breakpoint/breakpoint-manager.d.ts +85 -45
- package/lib/browser/breakpoint/breakpoint-manager.d.ts.map +1 -1
- package/lib/browser/breakpoint/breakpoint-manager.js +558 -170
- package/lib/browser/breakpoint/breakpoint-manager.js.map +1 -1
- package/lib/browser/breakpoint/breakpoint-manager.spec.d.ts +2 -0
- package/lib/browser/breakpoint/breakpoint-manager.spec.d.ts.map +1 -0
- package/lib/browser/breakpoint/breakpoint-manager.spec.js +916 -0
- package/lib/browser/breakpoint/breakpoint-manager.spec.js.map +1 -0
- package/lib/browser/breakpoint/breakpoint-marker.d.ts +7 -10
- package/lib/browser/breakpoint/breakpoint-marker.d.ts.map +1 -1
- package/lib/browser/breakpoint/breakpoint-marker.js +14 -11
- package/lib/browser/breakpoint/breakpoint-marker.js.map +1 -1
- package/lib/browser/breakpoint/debug-data-breakpoint-actions.js +1 -1
- package/lib/browser/breakpoint/debug-data-breakpoint-actions.js.map +1 -1
- package/lib/browser/debug-frontend-application-contribution.d.ts +1 -2
- package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/debug-frontend-application-contribution.js +13 -21
- package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
- package/lib/browser/debug-frontend-module.d.ts.map +1 -1
- package/lib/browser/debug-frontend-module.js +3 -0
- package/lib/browser/debug-frontend-module.js.map +1 -1
- package/lib/browser/debug-session-manager.d.ts +8 -27
- package/lib/browser/debug-session-manager.d.ts.map +1 -1
- package/lib/browser/debug-session-manager.js +14 -132
- package/lib/browser/debug-session-manager.js.map +1 -1
- package/lib/browser/debug-session.d.ts +1 -21
- package/lib/browser/debug-session.d.ts.map +1 -1
- package/lib/browser/debug-session.js +72 -203
- package/lib/browser/debug-session.js.map +1 -1
- package/lib/browser/disassembly-view/disassembly-view-breakpoint-renderer.js +1 -1
- package/lib/browser/disassembly-view/disassembly-view-breakpoint-renderer.js.map +1 -1
- package/lib/browser/disassembly-view/disassembly-view-widget.d.ts.map +1 -1
- package/lib/browser/disassembly-view/disassembly-view-widget.js +17 -24
- package/lib/browser/disassembly-view/disassembly-view-widget.js.map +1 -1
- package/lib/browser/editor/debug-editor-model.d.ts +15 -5
- package/lib/browser/editor/debug-editor-model.d.ts.map +1 -1
- package/lib/browser/editor/debug-editor-model.js +56 -32
- package/lib/browser/editor/debug-editor-model.js.map +1 -1
- package/lib/browser/model/debug-breakpoint-opener.d.ts +14 -0
- package/lib/browser/model/debug-breakpoint-opener.d.ts.map +1 -0
- package/lib/browser/model/debug-breakpoint-opener.js +67 -0
- package/lib/browser/model/debug-breakpoint-opener.js.map +1 -0
- package/lib/browser/model/debug-breakpoint.d.ts +32 -13
- package/lib/browser/model/debug-breakpoint.d.ts.map +1 -1
- package/lib/browser/model/debug-breakpoint.js +76 -16
- package/lib/browser/model/debug-breakpoint.js.map +1 -1
- package/lib/browser/model/debug-data-breakpoint.d.ts +1 -0
- package/lib/browser/model/debug-data-breakpoint.d.ts.map +1 -1
- package/lib/browser/model/debug-data-breakpoint.js +6 -5
- package/lib/browser/model/debug-data-breakpoint.js.map +1 -1
- package/lib/browser/model/debug-function-breakpoint.d.ts +4 -1
- package/lib/browser/model/debug-function-breakpoint.d.ts.map +1 -1
- package/lib/browser/model/debug-function-breakpoint.js +20 -29
- package/lib/browser/model/debug-function-breakpoint.js.map +1 -1
- package/lib/browser/model/debug-instruction-breakpoint.d.ts +2 -1
- package/lib/browser/model/debug-instruction-breakpoint.d.ts.map +1 -1
- package/lib/browser/model/debug-instruction-breakpoint.js +8 -8
- package/lib/browser/model/debug-instruction-breakpoint.js.map +1 -1
- package/lib/browser/model/debug-source-breakpoint.d.ts +6 -15
- package/lib/browser/model/debug-source-breakpoint.d.ts.map +1 -1
- package/lib/browser/model/debug-source-breakpoint.js +16 -90
- package/lib/browser/model/debug-source-breakpoint.js.map +1 -1
- package/lib/browser/view/debug-breakpoints-source.d.ts +0 -2
- package/lib/browser/view/debug-breakpoints-source.d.ts.map +1 -1
- package/lib/browser/view/debug-breakpoints-source.js +2 -10
- package/lib/browser/view/debug-breakpoints-source.js.map +1 -1
- package/lib/browser/view/debug-breakpoints-widget.d.ts +2 -0
- package/lib/browser/view/debug-breakpoints-widget.d.ts.map +1 -1
- package/lib/browser/view/debug-breakpoints-widget.js +3 -0
- package/lib/browser/view/debug-breakpoints-widget.js.map +1 -1
- package/lib/browser/view/debug-exception-breakpoint.d.ts +18 -11
- package/lib/browser/view/debug-exception-breakpoint.d.ts.map +1 -1
- package/lib/browser/view/debug-exception-breakpoint.js +58 -24
- package/lib/browser/view/debug-exception-breakpoint.js.map +1 -1
- package/lib/browser/view/debug-view-model.d.ts +8 -4
- package/lib/browser/view/debug-view-model.d.ts.map +1 -1
- package/lib/browser/view/debug-view-model.js +15 -8
- package/lib/browser/view/debug-view-model.js.map +1 -1
- package/package.json +16 -16
- package/src/browser/breakpoint/breakpoint-manager.spec.ts +1179 -0
- package/src/browser/breakpoint/breakpoint-manager.ts +589 -195
- package/src/browser/breakpoint/breakpoint-marker.ts +21 -15
- package/src/browser/breakpoint/debug-data-breakpoint-actions.ts +1 -1
- package/src/browser/debug-frontend-application-contribution.ts +18 -23
- package/src/browser/debug-frontend-module.ts +5 -1
- package/src/browser/debug-session-manager.ts +15 -147
- package/src/browser/debug-session.tsx +71 -221
- package/src/browser/disassembly-view/disassembly-view-breakpoint-renderer.ts +1 -1
- package/src/browser/disassembly-view/disassembly-view-widget.ts +17 -23
- package/src/browser/editor/debug-editor-model.ts +58 -35
- package/src/browser/model/debug-breakpoint-opener.ts +51 -0
- package/src/browser/model/debug-breakpoint.tsx +101 -20
- package/src/browser/model/debug-data-breakpoint.tsx +8 -5
- package/src/browser/model/debug-function-breakpoint.tsx +18 -29
- package/src/browser/model/debug-instruction-breakpoint.tsx +10 -8
- package/src/browser/model/debug-source-breakpoint.tsx +23 -101
- package/src/browser/view/debug-breakpoints-source.tsx +2 -9
- package/src/browser/view/debug-breakpoints-widget.ts +6 -0
- package/src/browser/view/debug-exception-breakpoint.tsx +66 -27
- package/src/browser/view/debug-view-model.ts +20 -12
|
@@ -17,19 +17,24 @@
|
|
|
17
17
|
var BreakpointManager_1;
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.BreakpointManager = void 0;
|
|
20
|
-
exports.diff = diff;
|
|
21
20
|
const tslib_1 = require("tslib");
|
|
22
|
-
const deepEqual = require("fast-deep-equal");
|
|
23
21
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
24
22
|
const common_1 = require("@theia/core/lib/common");
|
|
25
23
|
const browser_1 = require("@theia/core/lib/browser");
|
|
26
|
-
const marker_manager_1 = require("@theia/markers/lib/browser/marker-manager");
|
|
27
24
|
const uri_1 = require("@theia/core/lib/common/uri");
|
|
28
25
|
const breakpoint_marker_1 = require("./breakpoint-marker");
|
|
29
|
-
|
|
26
|
+
const debug_source_breakpoint_1 = require("../model/debug-source-breakpoint");
|
|
27
|
+
const debug_function_breakpoint_1 = require("../model/debug-function-breakpoint");
|
|
28
|
+
const debug_instruction_breakpoint_1 = require("../model/debug-instruction-breakpoint");
|
|
29
|
+
const debug_exception_breakpoint_1 = require("../view/debug-exception-breakpoint");
|
|
30
|
+
const debug_data_breakpoint_1 = require("../model/debug-data-breakpoint");
|
|
31
|
+
const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
|
|
32
|
+
let BreakpointManager = class BreakpointManager {
|
|
30
33
|
constructor() {
|
|
31
|
-
|
|
32
|
-
this.
|
|
34
|
+
// ── Source breakpoints, keyed by URI string ──
|
|
35
|
+
this.sourceBreakpoints = new Map();
|
|
36
|
+
// ── Events ──
|
|
37
|
+
this.onDidChangeMarkersEmitter = new common_1.Emitter();
|
|
33
38
|
this.onDidChangeBreakpointsEmitter = new common_1.Emitter();
|
|
34
39
|
this.onDidChangeBreakpoints = this.onDidChangeBreakpointsEmitter.event;
|
|
35
40
|
this.onDidChangeFunctionBreakpointsEmitter = new common_1.Emitter();
|
|
@@ -38,10 +43,15 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
|
|
|
38
43
|
this.onDidChangeInstructionBreakpoints = this.onDidChangeInstructionBreakpointsEmitter.event;
|
|
39
44
|
this.onDidChangeDataBreakpointsEmitter = new common_1.Emitter();
|
|
40
45
|
this.onDidChangeDataBreakpoints = this.onDidChangeDataBreakpointsEmitter.event;
|
|
46
|
+
// ── Enable / disable ──
|
|
41
47
|
this._breakpointsEnabled = true;
|
|
42
|
-
|
|
48
|
+
// ── Exception breakpoints ──
|
|
49
|
+
this.exceptionBreakpoints = new Array();
|
|
50
|
+
// ── Function breakpoints ──
|
|
43
51
|
this.functionBreakpoints = [];
|
|
52
|
+
// ── Instruction breakpoints ──
|
|
44
53
|
this.instructionBreakpoints = [];
|
|
54
|
+
// ── Data breakpoints ──
|
|
45
55
|
this.dataBreakpoints = [];
|
|
46
56
|
}
|
|
47
57
|
static { BreakpointManager_1 = this; }
|
|
@@ -49,142 +59,424 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
|
|
|
49
59
|
static { this.FUNCTION_URI = new uri_1.default('debug:function://'); }
|
|
50
60
|
static { this.INSTRUCTION_URI = new uri_1.default('debug:instruction://'); }
|
|
51
61
|
static { this.DATA_URI = new uri_1.default('debug:data://'); }
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Fires when any breakpoint type changes (source, function, instruction, data, or exception).
|
|
64
|
+
* The URI identifies the affected resource or the synthetic URI for non-source breakpoint types
|
|
65
|
+
* (e.g. {@link BreakpointManager.FUNCTION_URI}).
|
|
66
|
+
*/
|
|
67
|
+
get onDidChangeMarkers() {
|
|
68
|
+
return this.onDidChangeMarkersEmitter.event;
|
|
69
|
+
}
|
|
70
|
+
fireOnDidChangeMarkers(uri) {
|
|
71
|
+
this.onDidChangeMarkersEmitter.fire(uri);
|
|
72
|
+
}
|
|
73
|
+
// ── Initialization ──
|
|
74
|
+
init() {
|
|
75
|
+
this.fileService.onDidFilesChange(event => {
|
|
76
|
+
if (event.gotDeleted()) {
|
|
77
|
+
for (const uriString of this.sourceBreakpoints.keys()) {
|
|
78
|
+
const uri = new uri_1.default(uriString);
|
|
79
|
+
if (event.contains(uri, 2 /* FileChangeType.DELETED */)) {
|
|
80
|
+
this.sourceBreakpoints.delete(uriString);
|
|
81
|
+
this.fireOnDidChangeMarkers(uri);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// ── Source breakpoint storage ──
|
|
88
|
+
getBreakpoints(uri) {
|
|
89
|
+
if (uri) {
|
|
90
|
+
return this.sourceBreakpoints.get(uri.toString()) ?? [];
|
|
91
|
+
}
|
|
92
|
+
const result = [];
|
|
93
|
+
for (const bps of this.sourceBreakpoints.values()) {
|
|
94
|
+
result.push(...bps);
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
getUris() {
|
|
99
|
+
return this.sourceBreakpoints.keys();
|
|
100
|
+
}
|
|
101
|
+
hasBreakpoints() {
|
|
102
|
+
return this.sourceBreakpoints.size > 0 || this.functionBreakpoints.length > 0 || this.instructionBreakpoints.length > 0;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Replace the source breakpoints for a URI. Incoming `breakpoints` are
|
|
106
|
+
* plain `SourceBreakpoint` data; existing `DebugSourceBreakpoint` wrappers
|
|
107
|
+
* are preserved by ID so that session data survives position changes.
|
|
108
|
+
*/
|
|
109
|
+
setBreakpoints(uri, breakpoints) {
|
|
110
|
+
const current = this.getBreakpoints(uri);
|
|
111
|
+
const currentById = new Map(current.map(bp => [bp.id, bp]));
|
|
112
|
+
const sorted = breakpoints
|
|
113
|
+
.slice()
|
|
114
|
+
.sort((a, b) => (a.raw.line - b.raw.line) || ((a.raw.column || 0) - (b.raw.column || 0)));
|
|
115
|
+
const seen = new Set();
|
|
116
|
+
const newBps = [];
|
|
117
|
+
for (const bp of sorted) {
|
|
118
|
+
const posKey = `${bp.raw.line}:${bp.raw.column ?? 0}`;
|
|
119
|
+
if (seen.has(posKey)) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
seen.add(posKey);
|
|
123
|
+
// Prefer matching by ID (preserves identity across position changes).
|
|
124
|
+
const existing = currentById.get(bp.id);
|
|
125
|
+
if (existing) {
|
|
126
|
+
existing.origin.raw = bp.raw;
|
|
127
|
+
existing.origin.enabled = bp.enabled;
|
|
128
|
+
newBps.push(existing);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
newBps.push(this.toDebugSourceBreakpoint(bp));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
this.applySourceBreakpoints(uri, newBps, current);
|
|
54
135
|
}
|
|
55
|
-
|
|
56
|
-
const
|
|
136
|
+
addBreakpoint(breakpoint) {
|
|
137
|
+
const uri = new uri_1.default(breakpoint.uri);
|
|
138
|
+
const current = this.getBreakpoints(uri);
|
|
139
|
+
// Check for positional duplicate.
|
|
140
|
+
const duplicate = current.find(c => c.line === breakpoint.raw.line && c.column === breakpoint.raw.column);
|
|
141
|
+
if (duplicate) {
|
|
142
|
+
return duplicate;
|
|
143
|
+
}
|
|
144
|
+
const bp = this.toDebugSourceBreakpoint(breakpoint);
|
|
145
|
+
const newBps = [...current, bp];
|
|
146
|
+
this.applySourceBreakpoints(uri, newBps, current);
|
|
147
|
+
return bp;
|
|
148
|
+
}
|
|
149
|
+
removeBreakpoint(breakpoint) {
|
|
150
|
+
const current = this.getBreakpoints(breakpoint.uri);
|
|
151
|
+
const index = current.indexOf(breakpoint);
|
|
152
|
+
if (index === -1) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const retained = [...current.slice(0, index), ...current.slice(index + 1)];
|
|
156
|
+
this.applySourceBreakpoints(breakpoint.uri, retained, current);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Diff `oldBps` → `newBps`, store, fire markers and typed events.
|
|
160
|
+
* Both arrays must be for the same URI.
|
|
161
|
+
*/
|
|
162
|
+
applySourceBreakpoints(uri, newBps, oldBps) {
|
|
163
|
+
const oldById = new Map(oldBps.map(bp => [bp.id, bp]));
|
|
57
164
|
const added = [];
|
|
58
|
-
const removed = [];
|
|
59
165
|
const changed = [];
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (!oldMarker) {
|
|
67
|
-
added.push(newMarker);
|
|
166
|
+
let didChange = false;
|
|
167
|
+
for (const bp of newBps) {
|
|
168
|
+
const old = oldById.get(bp.id);
|
|
169
|
+
if (!old) {
|
|
170
|
+
added.push(bp);
|
|
171
|
+
didChange = true;
|
|
68
172
|
}
|
|
69
173
|
else {
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
// (
|
|
73
|
-
|
|
74
|
-
|
|
174
|
+
changed.push(bp);
|
|
175
|
+
// Identity match: the wrapper was mutated in place, or the same
|
|
176
|
+
// object was passed back (editor model position update).
|
|
177
|
+
// Either way we must re-fire to keep decorations in sync.
|
|
178
|
+
didChange = true;
|
|
179
|
+
oldById.delete(bp.id);
|
|
75
180
|
}
|
|
76
181
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
182
|
+
const removed = Array.from(oldById.values());
|
|
183
|
+
didChange ||= removed.length > 0;
|
|
184
|
+
if (!didChange) {
|
|
185
|
+
return;
|
|
81
186
|
}
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
this.onDidChangeBreakpointsEmitter.fire({ uri, added, removed, changed });
|
|
187
|
+
if (newBps.length > 0) {
|
|
188
|
+
this.sourceBreakpoints.set(uri.toString(), [...newBps]);
|
|
85
189
|
}
|
|
86
|
-
|
|
190
|
+
else {
|
|
191
|
+
this.sourceBreakpoints.delete(uri.toString());
|
|
192
|
+
}
|
|
193
|
+
this.fireOnDidChangeMarkers(uri);
|
|
194
|
+
this.onDidChangeBreakpointsEmitter.fire({ uri, added, removed, changed });
|
|
195
|
+
}
|
|
196
|
+
removeBreakpoints() {
|
|
197
|
+
for (const uriString of [...this.sourceBreakpoints.keys()]) {
|
|
198
|
+
const uri = new uri_1.default(uriString);
|
|
199
|
+
const old = this.sourceBreakpoints.get(uriString) ?? [];
|
|
200
|
+
this.sourceBreakpoints.delete(uriString);
|
|
201
|
+
this.fireOnDidChangeMarkers(uri);
|
|
202
|
+
if (old.length) {
|
|
203
|
+
this.onDidChangeBreakpointsEmitter.fire({ uri, added: [], removed: old, changed: [] });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
this.setFunctionBreakpoints([]);
|
|
207
|
+
this.setInstructionBreakpoints([]);
|
|
208
|
+
this.setDataBreakpoints([]);
|
|
87
209
|
}
|
|
210
|
+
// ── Query helpers ──
|
|
88
211
|
getLineBreakpoints(uri, line) {
|
|
89
|
-
return this.
|
|
90
|
-
uri,
|
|
91
|
-
dataFilter: breakpoint => breakpoint.raw.line === line
|
|
92
|
-
}).map(({ data }) => data);
|
|
212
|
+
return this.getBreakpoints(uri).filter(bp => bp.line === line);
|
|
93
213
|
}
|
|
94
214
|
getInlineBreakpoint(uri, line, column) {
|
|
95
|
-
|
|
96
|
-
uri,
|
|
97
|
-
dataFilter: breakpoint => breakpoint.raw.line === line && breakpoint.raw.column === column
|
|
98
|
-
})[0];
|
|
99
|
-
return marker && marker.data;
|
|
215
|
+
return this.getBreakpoints(uri).find(bp => bp.line === line && bp.column === column);
|
|
100
216
|
}
|
|
101
|
-
|
|
102
|
-
|
|
217
|
+
getBreakpointById(id) {
|
|
218
|
+
for (const bp of this.allBreakpoints()) {
|
|
219
|
+
if (bp.id === id) {
|
|
220
|
+
return bp;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
103
223
|
}
|
|
104
|
-
|
|
105
|
-
|
|
224
|
+
*allBreakpoints() {
|
|
225
|
+
for (const bps of this.sourceBreakpoints.values()) {
|
|
226
|
+
yield* bps;
|
|
227
|
+
}
|
|
228
|
+
yield* this.functionBreakpoints;
|
|
229
|
+
yield* this.instructionBreakpoints;
|
|
230
|
+
yield* this.exceptionBreakpoints;
|
|
231
|
+
yield* this.dataBreakpoints;
|
|
232
|
+
}
|
|
233
|
+
// ── Session data ──
|
|
234
|
+
updateSessionData(sessionId, sessionCapabilities, bps) {
|
|
235
|
+
const bpCapabilities = this.toBpCapabilities(sessionCapabilities);
|
|
236
|
+
const updatedUris = new Map();
|
|
237
|
+
for (const bp of this.allBreakpoints()) {
|
|
238
|
+
if (!bps) {
|
|
239
|
+
if (bp.update(sessionId, undefined)) {
|
|
240
|
+
common_1.MapUtils.addOrInsertWith(updatedUris, bp.uri.toString(), bp);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
const dataForBp = bps.get(bp.id);
|
|
245
|
+
if (!dataForBp) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
bp.update(sessionId, { ...bpCapabilities, ...dataForBp });
|
|
249
|
+
common_1.MapUtils.addOrInsertWith(updatedUris, bp.uri.toString(), bp);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
for (const changed of updatedUris.values()) {
|
|
253
|
+
this.fireTypedBreakpointEvent(changed[0].uri, [], changed, []);
|
|
254
|
+
}
|
|
106
255
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
256
|
+
toBpCapabilities(capabilities) {
|
|
257
|
+
return {
|
|
258
|
+
supportsConditionalBreakpoints: !!capabilities.supportsConditionalBreakpoints,
|
|
259
|
+
supportsHitConditionalBreakpoints: !!capabilities.supportsHitConditionalBreakpoints,
|
|
260
|
+
supportsLogPoints: !!capabilities.supportsLogPoints,
|
|
261
|
+
supportsFunctionBreakpoints: !!capabilities.supportsFunctionBreakpoints,
|
|
262
|
+
supportsDataBreakpoints: !!capabilities.supportsDataBreakpoints,
|
|
263
|
+
supportsInstructionBreakpoints: !!capabilities.supportsInstructionBreakpoints,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
// ── Breakpoint construction ──
|
|
267
|
+
toDebugSourceBreakpoint(source) {
|
|
268
|
+
return debug_source_breakpoint_1.DebugSourceBreakpoint.create(source, this.getBreakpointOptions());
|
|
269
|
+
}
|
|
270
|
+
getBreakpointOptions() {
|
|
271
|
+
if (!this._breakpointOptions) {
|
|
272
|
+
this._breakpointOptions = {
|
|
273
|
+
labelProvider: this.labelProvider,
|
|
274
|
+
openerService: this.openerService,
|
|
275
|
+
commandService: this.commandService,
|
|
276
|
+
breakpoints: this
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return this._breakpointOptions;
|
|
280
|
+
}
|
|
281
|
+
get breakpointsEnabled() {
|
|
282
|
+
return this._breakpointsEnabled;
|
|
283
|
+
}
|
|
284
|
+
set breakpointsEnabled(breakpointsEnabled) {
|
|
285
|
+
if (this._breakpointsEnabled !== breakpointsEnabled) {
|
|
286
|
+
this._breakpointsEnabled = breakpointsEnabled;
|
|
287
|
+
for (const uri of this.getUris()) {
|
|
288
|
+
this.fireOnDidChangeMarkers(new uri_1.default(uri));
|
|
289
|
+
}
|
|
290
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.FUNCTION_URI);
|
|
291
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
|
|
292
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
|
|
293
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
|
|
115
294
|
}
|
|
116
|
-
return false;
|
|
117
295
|
}
|
|
118
296
|
enableAllBreakpoints(enabled) {
|
|
119
297
|
for (const uriString of this.getUris()) {
|
|
120
298
|
let didChange = false;
|
|
121
299
|
const uri = new uri_1.default(uriString);
|
|
122
|
-
const
|
|
123
|
-
for (const
|
|
124
|
-
|
|
125
|
-
marker.data.enabled = enabled;
|
|
126
|
-
didChange = true;
|
|
127
|
-
}
|
|
300
|
+
const bps = this.getBreakpoints(uri);
|
|
301
|
+
for (const bp of bps) {
|
|
302
|
+
didChange ||= this.doEnableBreakpoint(bp, enabled);
|
|
128
303
|
}
|
|
129
304
|
if (didChange) {
|
|
130
305
|
this.fireOnDidChangeMarkers(uri);
|
|
306
|
+
this.onDidChangeBreakpointsEmitter.fire({ uri, added: [], removed: [], changed: [...bps] });
|
|
131
307
|
}
|
|
132
308
|
}
|
|
133
309
|
let didChangeFunction = false;
|
|
134
|
-
for (const breakpoint of this.
|
|
135
|
-
if (breakpoint.enabled !== enabled) {
|
|
136
|
-
breakpoint.enabled = enabled;
|
|
310
|
+
for (const breakpoint of this.functionBreakpoints) {
|
|
311
|
+
if (breakpoint.origin.enabled !== enabled) {
|
|
312
|
+
breakpoint.origin.enabled = enabled;
|
|
137
313
|
didChangeFunction = true;
|
|
138
314
|
}
|
|
139
315
|
}
|
|
140
316
|
if (didChangeFunction) {
|
|
141
317
|
this.fireOnDidChangeMarkers(BreakpointManager_1.FUNCTION_URI);
|
|
318
|
+
this.onDidChangeFunctionBreakpointsEmitter.fire({
|
|
319
|
+
uri: BreakpointManager_1.FUNCTION_URI, added: [], removed: [], changed: [...this.functionBreakpoints]
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
let didChangeInstruction = false;
|
|
323
|
+
for (const breakpoint of this.instructionBreakpoints) {
|
|
324
|
+
if (breakpoint.origin.enabled !== enabled) {
|
|
325
|
+
breakpoint.origin.enabled = enabled;
|
|
326
|
+
didChangeInstruction = true;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
if (didChangeInstruction) {
|
|
330
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
|
|
331
|
+
this.onDidChangeInstructionBreakpointsEmitter.fire({
|
|
332
|
+
uri: BreakpointManager_1.INSTRUCTION_URI, added: [], removed: [], changed: [...this.instructionBreakpoints]
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
let didChangeData = false;
|
|
336
|
+
for (const breakpoint of this.dataBreakpoints) {
|
|
337
|
+
if (breakpoint.origin.enabled !== enabled) {
|
|
338
|
+
breakpoint.origin.enabled = enabled;
|
|
339
|
+
didChangeData = true;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (didChangeData) {
|
|
343
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
|
|
344
|
+
this.onDidChangeDataBreakpointsEmitter.fire({
|
|
345
|
+
uri: BreakpointManager_1.DATA_URI, added: [], removed: [], changed: [...this.dataBreakpoints]
|
|
346
|
+
});
|
|
142
347
|
}
|
|
143
348
|
}
|
|
144
|
-
|
|
145
|
-
|
|
349
|
+
enableBreakpoint(breakpoint, enabled) {
|
|
350
|
+
const didChange = this.doEnableBreakpoint(breakpoint, enabled);
|
|
351
|
+
if (didChange) {
|
|
352
|
+
this.fireBreakpointChanged(breakpoint);
|
|
353
|
+
}
|
|
146
354
|
}
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
355
|
+
doEnableBreakpoint(breakpoint, enabled) {
|
|
356
|
+
if (breakpoint.origin.enabled !== enabled) {
|
|
357
|
+
breakpoint.origin.enabled = enabled;
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
// ── Generic update / fire ──
|
|
363
|
+
updateBreakpoint(bp, update) {
|
|
364
|
+
bp.origin.raw = { ...bp.origin.raw, ...update };
|
|
365
|
+
this.fireBreakpointChanged(bp);
|
|
366
|
+
}
|
|
367
|
+
fireBreakpointChanged(breakpoint) {
|
|
368
|
+
this.fireOnDidChangeMarkers(breakpoint.uri);
|
|
369
|
+
this.fireTypedBreakpointEvent(breakpoint.uri, [], [breakpoint], []);
|
|
370
|
+
}
|
|
371
|
+
fireTypedBreakpointEvent(uri, added, changed, removed) {
|
|
372
|
+
// All breakpoints in a single call are the same type (grouped by URI).
|
|
373
|
+
const sample = added[0] ?? changed[0] ?? removed[0];
|
|
374
|
+
if (!sample) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (sample instanceof debug_source_breakpoint_1.DebugSourceBreakpoint) {
|
|
378
|
+
this.onDidChangeBreakpointsEmitter.fire({ uri, added, changed, removed });
|
|
379
|
+
}
|
|
380
|
+
else if (sample instanceof debug_function_breakpoint_1.DebugFunctionBreakpoint) {
|
|
381
|
+
this.onDidChangeFunctionBreakpointsEmitter.fire({ uri, added, changed, removed });
|
|
382
|
+
}
|
|
383
|
+
else if (sample instanceof debug_instruction_breakpoint_1.DebugInstructionBreakpoint) {
|
|
384
|
+
this.onDidChangeInstructionBreakpointsEmitter.fire({ uri, added, changed, removed });
|
|
385
|
+
}
|
|
386
|
+
else if (sample instanceof debug_data_breakpoint_1.DebugDataBreakpoint) {
|
|
387
|
+
this.onDidChangeDataBreakpointsEmitter.fire({ uri, added, changed, removed });
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// ── Bulk remove by ID (plugin API) ──
|
|
391
|
+
removeBreakpointsById(ids) {
|
|
392
|
+
const toRemove = new Set(ids);
|
|
393
|
+
// Source breakpoints
|
|
394
|
+
for (const [uriString, bps] of this.sourceBreakpoints.entries()) {
|
|
395
|
+
const retained = bps.filter(bp => !toRemove.has(bp.id));
|
|
396
|
+
if (retained.length !== bps.length) {
|
|
397
|
+
const removed = bps.filter(bp => toRemove.has(bp.id));
|
|
398
|
+
const uri = new uri_1.default(uriString);
|
|
399
|
+
if (retained.length > 0) {
|
|
400
|
+
this.sourceBreakpoints.set(uriString, retained);
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
this.sourceBreakpoints.delete(uriString);
|
|
404
|
+
}
|
|
405
|
+
this.fireOnDidChangeMarkers(uri);
|
|
406
|
+
this.onDidChangeBreakpointsEmitter.fire({ uri, removed, added: [], changed: [] });
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
// Function breakpoints
|
|
410
|
+
const functionRemoved = [];
|
|
411
|
+
this.functionBreakpoints = this.functionBreakpoints.filter(bp => {
|
|
412
|
+
if (toRemove.has(bp.id)) {
|
|
413
|
+
functionRemoved.push(bp);
|
|
414
|
+
return false;
|
|
152
415
|
}
|
|
416
|
+
return true;
|
|
417
|
+
});
|
|
418
|
+
if (functionRemoved.length) {
|
|
153
419
|
this.fireOnDidChangeMarkers(BreakpointManager_1.FUNCTION_URI);
|
|
420
|
+
this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: BreakpointManager_1.FUNCTION_URI, removed: functionRemoved, added: [], changed: [] });
|
|
421
|
+
}
|
|
422
|
+
// Instruction breakpoints
|
|
423
|
+
const instructionRemoved = [];
|
|
424
|
+
this.instructionBreakpoints = this.instructionBreakpoints.filter(bp => {
|
|
425
|
+
if (toRemove.has(bp.id)) {
|
|
426
|
+
instructionRemoved.push(bp);
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
return true;
|
|
430
|
+
});
|
|
431
|
+
if (instructionRemoved.length) {
|
|
432
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
|
|
433
|
+
this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, removed: instructionRemoved, added: [], changed: [] });
|
|
434
|
+
}
|
|
435
|
+
// Data breakpoints
|
|
436
|
+
const dataRemoved = [];
|
|
437
|
+
this.dataBreakpoints = this.dataBreakpoints.filter(bp => {
|
|
438
|
+
if (toRemove.has(bp.id)) {
|
|
439
|
+
dataRemoved.push(bp);
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
return true;
|
|
443
|
+
});
|
|
444
|
+
if (dataRemoved.length) {
|
|
445
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
|
|
446
|
+
this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, removed: dataRemoved, added: [], changed: [] });
|
|
154
447
|
}
|
|
155
448
|
}
|
|
156
449
|
getExceptionBreakpoint(filter) {
|
|
157
|
-
return this.exceptionBreakpoints.
|
|
450
|
+
return this.exceptionBreakpoints.find(candidate => breakpoint_marker_1.ExceptionBreakpoint.matches(candidate.origin.raw, filter));
|
|
158
451
|
}
|
|
159
452
|
getExceptionBreakpoints() {
|
|
160
|
-
return this.exceptionBreakpoints
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
this.
|
|
171
|
-
}
|
|
172
|
-
if (toRemove.size || exceptionBreakpoints.length) {
|
|
173
|
-
this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
|
|
453
|
+
return this.exceptionBreakpoints;
|
|
454
|
+
}
|
|
455
|
+
addExceptionBreakpoints(filters, sessionId) {
|
|
456
|
+
for (const filter of filters) {
|
|
457
|
+
let bp = this.exceptionBreakpoints.find(candidate => breakpoint_marker_1.ExceptionBreakpoint.matches(candidate.origin.raw, filter));
|
|
458
|
+
if (!bp) {
|
|
459
|
+
bp = debug_exception_breakpoint_1.DebugExceptionBreakpoint.create(breakpoint_marker_1.ExceptionBreakpoint.create(filter), this.getBreakpointOptions());
|
|
460
|
+
this.exceptionBreakpoints.push(bp);
|
|
461
|
+
}
|
|
462
|
+
bp.setSessionEnablement(sessionId, true);
|
|
463
|
+
this.doUpdateExceptionBreakpointVisibility(sessionId);
|
|
174
464
|
}
|
|
465
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
|
|
175
466
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
467
|
+
updateExceptionBreakpointVisibility(sessionId) {
|
|
468
|
+
this.doUpdateExceptionBreakpointVisibility(sessionId);
|
|
469
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
|
|
470
|
+
}
|
|
471
|
+
clearExceptionSessionEnablement(sessionId) {
|
|
472
|
+
for (const bp of this.exceptionBreakpoints) {
|
|
473
|
+
bp.setSessionEnablement(sessionId, false);
|
|
181
474
|
}
|
|
475
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
|
|
182
476
|
}
|
|
183
|
-
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
Object.assign(breakpoint, options);
|
|
187
|
-
this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
|
|
477
|
+
doUpdateExceptionBreakpointVisibility(sessionId) {
|
|
478
|
+
for (const bp of this.exceptionBreakpoints) {
|
|
479
|
+
bp.setPersistentVisibility(bp.isEnabledForSession(sessionId));
|
|
188
480
|
}
|
|
189
481
|
}
|
|
190
482
|
getFunctionBreakpoints() {
|
|
@@ -192,13 +484,19 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
|
|
|
192
484
|
}
|
|
193
485
|
setFunctionBreakpoints(functionBreakpoints) {
|
|
194
486
|
const oldBreakpoints = new Map(this.functionBreakpoints.map(b => [b.id, b]));
|
|
195
|
-
this.functionBreakpoints = functionBreakpoints
|
|
487
|
+
this.functionBreakpoints = functionBreakpoints.map(bp => {
|
|
488
|
+
const existing = oldBreakpoints.get(bp.id);
|
|
489
|
+
if (existing) {
|
|
490
|
+
return existing;
|
|
491
|
+
}
|
|
492
|
+
return debug_function_breakpoint_1.DebugFunctionBreakpoint.create(bp, this.getBreakpointOptions());
|
|
493
|
+
});
|
|
196
494
|
this.fireOnDidChangeMarkers(BreakpointManager_1.FUNCTION_URI);
|
|
197
495
|
const added = [];
|
|
198
496
|
const removed = [];
|
|
199
497
|
const changed = [];
|
|
200
498
|
const ids = new Set();
|
|
201
|
-
for (const newBreakpoint of functionBreakpoints) {
|
|
499
|
+
for (const newBreakpoint of this.functionBreakpoints) {
|
|
202
500
|
ids.add(newBreakpoint.id);
|
|
203
501
|
if (oldBreakpoints.has(newBreakpoint.id)) {
|
|
204
502
|
changed.push(newBreakpoint);
|
|
@@ -214,85 +512,168 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
|
|
|
214
512
|
}
|
|
215
513
|
this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: BreakpointManager_1.FUNCTION_URI, added, removed, changed });
|
|
216
514
|
}
|
|
217
|
-
|
|
218
|
-
|
|
515
|
+
addFunctionBreakpoint(bp) {
|
|
516
|
+
const duplicate = this.functionBreakpoints.find(c => c.origin.raw.name === bp.raw.name);
|
|
517
|
+
if (duplicate) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
const newBp = debug_function_breakpoint_1.DebugFunctionBreakpoint.create(bp, this.getBreakpointOptions());
|
|
521
|
+
this.functionBreakpoints = [...this.functionBreakpoints, newBp];
|
|
522
|
+
this.fireOnDidChangeMarkers(newBp.uri);
|
|
523
|
+
this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: newBp.uri, added: [newBp], changed: [], removed: [] });
|
|
219
524
|
}
|
|
220
|
-
|
|
221
|
-
|
|
525
|
+
updateFunctionBreakpoint(bp, update) {
|
|
526
|
+
if (!this.functionBreakpoints.includes(bp)) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
const removed = [];
|
|
530
|
+
if ('name' in update && !update.name) {
|
|
531
|
+
throw new Error('Name field of function breakpoint must be populated.');
|
|
532
|
+
}
|
|
533
|
+
else if ('name' in update) {
|
|
534
|
+
this.functionBreakpoints = this.functionBreakpoints.filter(candidate => {
|
|
535
|
+
if (candidate !== bp && candidate.origin.raw.name === update.name) {
|
|
536
|
+
removed.push(candidate);
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
return true;
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
bp.origin.raw = { ...bp.origin.raw, ...update };
|
|
543
|
+
this.fireOnDidChangeMarkers(bp.uri);
|
|
544
|
+
this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: bp.uri, changed: [bp], removed, added: [] });
|
|
545
|
+
}
|
|
546
|
+
removeFunctionBreakpoint(breakpoint) {
|
|
547
|
+
const index = this.functionBreakpoints.indexOf(breakpoint);
|
|
548
|
+
if (index === -1) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
const removed = this.functionBreakpoints.splice(index, 1);
|
|
552
|
+
this.fireOnDidChangeMarkers(breakpoint.uri);
|
|
553
|
+
this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: breakpoint.uri, removed, added: [], changed: [] });
|
|
554
|
+
}
|
|
555
|
+
getInstructionBreakpoints() {
|
|
556
|
+
return this.instructionBreakpoints;
|
|
222
557
|
}
|
|
223
558
|
setInstructionBreakpoints(newBreakpoints) {
|
|
224
|
-
const
|
|
225
|
-
|
|
559
|
+
const oldBreakpoints = new Map(this.instructionBreakpoints.map(bp => [bp.id, bp]));
|
|
560
|
+
const currentBreakpoints = newBreakpoints.map(bp => {
|
|
561
|
+
const existing = oldBreakpoints.get(bp.id);
|
|
562
|
+
if (existing) {
|
|
563
|
+
return existing;
|
|
564
|
+
}
|
|
565
|
+
return debug_instruction_breakpoint_1.DebugInstructionBreakpoint.create(bp, this.getBreakpointOptions());
|
|
566
|
+
});
|
|
567
|
+
const added = [];
|
|
568
|
+
const changed = [];
|
|
569
|
+
for (const breakpoint of currentBreakpoints) {
|
|
570
|
+
const old = oldBreakpoints.get(breakpoint.id);
|
|
571
|
+
if (old) {
|
|
572
|
+
changed.push(old);
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
added.push(breakpoint);
|
|
576
|
+
}
|
|
577
|
+
oldBreakpoints.delete(breakpoint.id);
|
|
578
|
+
}
|
|
579
|
+
const removed = Array.from(oldBreakpoints.values());
|
|
580
|
+
this.instructionBreakpoints = currentBreakpoints;
|
|
226
581
|
this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
|
|
227
582
|
this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, added, removed, changed });
|
|
228
583
|
}
|
|
229
584
|
addInstructionBreakpoint(address, offset, condition, hitCondition) {
|
|
230
|
-
this.
|
|
585
|
+
const duplicate = this.instructionBreakpoints.find(c => c.origin.raw.instructionReference === address && (c.origin.raw.offset ?? 0) === (offset ?? 0));
|
|
586
|
+
if (duplicate) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
const newBp = debug_instruction_breakpoint_1.DebugInstructionBreakpoint.create(breakpoint_marker_1.InstructionBreakpoint.create({
|
|
231
590
|
instructionReference: address,
|
|
232
591
|
offset,
|
|
233
592
|
condition,
|
|
234
593
|
hitCondition,
|
|
235
|
-
})));
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (breakpoint) {
|
|
240
|
-
Object.assign(breakpoint, options);
|
|
241
|
-
this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
|
|
242
|
-
this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, changed: [breakpoint], added: [], removed: [] });
|
|
243
|
-
}
|
|
594
|
+
}), this.getBreakpointOptions());
|
|
595
|
+
this.instructionBreakpoints = [...this.instructionBreakpoints, newBp];
|
|
596
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
|
|
597
|
+
this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, added: [newBp], removed: [], changed: [] });
|
|
244
598
|
}
|
|
245
|
-
removeInstructionBreakpoint(
|
|
246
|
-
|
|
247
|
-
|
|
599
|
+
removeInstructionBreakpoint(breakpoint) {
|
|
600
|
+
const index = this.instructionBreakpoints.indexOf(breakpoint);
|
|
601
|
+
if (index === -1) {
|
|
602
|
+
return;
|
|
248
603
|
}
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
604
|
+
const removed = this.instructionBreakpoints.splice(index, 1);
|
|
605
|
+
this.fireOnDidChangeMarkers(breakpoint.uri);
|
|
606
|
+
this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: breakpoint.uri, removed, added: [], changed: [] });
|
|
607
|
+
}
|
|
608
|
+
removeInstructionBreakpointAt(address) {
|
|
609
|
+
const match = this.instructionBreakpoints.find(candidate => candidate.origin.raw.instructionReference === address);
|
|
610
|
+
if (match) {
|
|
611
|
+
this.removeInstructionBreakpoint(match);
|
|
254
612
|
}
|
|
255
613
|
}
|
|
256
614
|
clearInstructionBreakpoints() {
|
|
257
615
|
this.setInstructionBreakpoints([]);
|
|
258
616
|
}
|
|
259
617
|
getDataBreakpoints() {
|
|
260
|
-
return
|
|
618
|
+
return this.dataBreakpoints;
|
|
261
619
|
}
|
|
262
620
|
setDataBreakpoints(breakpoints) {
|
|
263
|
-
const
|
|
264
|
-
|
|
621
|
+
const oldBreakpoints = new Map(this.dataBreakpoints.map(bp => [bp.id, bp]));
|
|
622
|
+
const newBreakpoints = breakpoints.map(bp => {
|
|
623
|
+
const existing = oldBreakpoints.get(bp.id);
|
|
624
|
+
if (existing) {
|
|
625
|
+
return existing;
|
|
626
|
+
}
|
|
627
|
+
return debug_data_breakpoint_1.DebugDataBreakpoint.create(bp, this.getBreakpointOptions());
|
|
628
|
+
});
|
|
629
|
+
const added = [];
|
|
630
|
+
const changed = [];
|
|
631
|
+
for (const bp of newBreakpoints) {
|
|
632
|
+
if (oldBreakpoints.has(bp.id)) {
|
|
633
|
+
changed.push(bp);
|
|
634
|
+
}
|
|
635
|
+
else {
|
|
636
|
+
added.push(bp);
|
|
637
|
+
}
|
|
638
|
+
oldBreakpoints.delete(bp.id);
|
|
639
|
+
}
|
|
640
|
+
const removed = Array.from(oldBreakpoints.values());
|
|
641
|
+
this.dataBreakpoints = newBreakpoints;
|
|
265
642
|
this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
|
|
266
643
|
this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, added, removed, changed });
|
|
267
644
|
}
|
|
268
645
|
addDataBreakpoint(breakpoint) {
|
|
269
|
-
this.
|
|
270
|
-
|
|
271
|
-
updateDataBreakpoint(id, options) {
|
|
272
|
-
const breakpoint = this.dataBreakpoints.find(bp => bp.id === id);
|
|
273
|
-
if (!breakpoint) {
|
|
646
|
+
const duplicate = this.dataBreakpoints.find(c => c.origin.raw.dataId === breakpoint.raw.dataId);
|
|
647
|
+
if (duplicate) {
|
|
274
648
|
return;
|
|
275
649
|
}
|
|
276
|
-
|
|
277
|
-
|
|
650
|
+
const newBp = debug_data_breakpoint_1.DebugDataBreakpoint.create(breakpoint, this.getBreakpointOptions());
|
|
651
|
+
this.dataBreakpoints = [...this.dataBreakpoints, newBp];
|
|
278
652
|
this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
|
|
279
|
-
this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, added: [], removed: [], changed: [
|
|
653
|
+
this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, added: [newBp], removed: [], changed: [] });
|
|
280
654
|
}
|
|
281
|
-
|
|
282
|
-
|
|
655
|
+
updateDataBreakpoint(bp, options) {
|
|
656
|
+
if (!this.dataBreakpoints.includes(bp)) {
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
if (options.raw) {
|
|
660
|
+
Object.assign(bp.origin.raw, options.raw);
|
|
661
|
+
}
|
|
662
|
+
if (options.enabled !== undefined) {
|
|
663
|
+
bp.origin.enabled = options.enabled;
|
|
664
|
+
}
|
|
665
|
+
this.fireBreakpointChanged(bp);
|
|
666
|
+
}
|
|
667
|
+
removeDataBreakpoint(bp) {
|
|
668
|
+
const index = this.dataBreakpoints.indexOf(bp);
|
|
283
669
|
if (index < 0) {
|
|
284
670
|
return;
|
|
285
671
|
}
|
|
286
|
-
const removed = this.dataBreakpoints.splice(index);
|
|
672
|
+
const removed = this.dataBreakpoints.splice(index, 1);
|
|
287
673
|
this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
|
|
288
674
|
this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, added: [], removed, changed: [] });
|
|
289
675
|
}
|
|
290
|
-
|
|
291
|
-
this.cleanAllMarkers();
|
|
292
|
-
this.setFunctionBreakpoints([]);
|
|
293
|
-
this.setInstructionBreakpoints([]);
|
|
294
|
-
this.setDataBreakpoints([]);
|
|
295
|
-
}
|
|
676
|
+
// ── Persistence ──
|
|
296
677
|
async load() {
|
|
297
678
|
const data = await this.storage.getData('breakpoints', {
|
|
298
679
|
breakpointsEnabled: true,
|
|
@@ -307,33 +688,36 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
|
|
|
307
688
|
this.setFunctionBreakpoints(data.functionBreakpoints);
|
|
308
689
|
}
|
|
309
690
|
if (data.exceptionBreakpoints) {
|
|
310
|
-
this.
|
|
691
|
+
this.exceptionBreakpoints = data.exceptionBreakpoints.map(bp => debug_exception_breakpoint_1.DebugExceptionBreakpoint.create(bp, this.getBreakpointOptions()));
|
|
692
|
+
this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
|
|
311
693
|
}
|
|
312
694
|
if (data.instructionBreakpoints) {
|
|
313
695
|
this.setInstructionBreakpoints(data.instructionBreakpoints);
|
|
314
696
|
}
|
|
697
|
+
if (data.dataBreakpoints) {
|
|
698
|
+
this.setDataBreakpoints(data.dataBreakpoints);
|
|
699
|
+
}
|
|
315
700
|
}
|
|
316
701
|
save() {
|
|
317
702
|
const data = {
|
|
318
703
|
breakpointsEnabled: this._breakpointsEnabled,
|
|
319
704
|
breakpoints: {}
|
|
320
705
|
};
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
data.breakpoints[uri] = this.findMarkers({ uri: new uri_1.default(uri) }).map(marker => marker.data);
|
|
706
|
+
for (const uri of this.getUris()) {
|
|
707
|
+
data.breakpoints[uri] = (this.sourceBreakpoints.get(uri) ?? []).map(bp => bp.origin);
|
|
324
708
|
}
|
|
325
709
|
if (this.functionBreakpoints.length) {
|
|
326
|
-
data.functionBreakpoints = this.functionBreakpoints;
|
|
710
|
+
data.functionBreakpoints = this.functionBreakpoints.map(({ origin }) => origin);
|
|
327
711
|
}
|
|
328
|
-
if (this.exceptionBreakpoints.
|
|
329
|
-
data.exceptionBreakpoints =
|
|
712
|
+
if (this.exceptionBreakpoints.length) {
|
|
713
|
+
data.exceptionBreakpoints = this.exceptionBreakpoints.filter(candidate => candidate.isPersistentlyVisible()).map(({ origin }) => origin);
|
|
330
714
|
}
|
|
331
715
|
if (this.instructionBreakpoints.length) {
|
|
332
|
-
data.instructionBreakpoints = this.instructionBreakpoints;
|
|
716
|
+
data.instructionBreakpoints = this.instructionBreakpoints.map(({ origin }) => origin);
|
|
333
717
|
}
|
|
334
|
-
const dataBreakpointsToStore = this.dataBreakpoints.filter(candidate => candidate.info.canPersist);
|
|
718
|
+
const dataBreakpointsToStore = this.dataBreakpoints.filter(candidate => candidate.origin.info.canPersist);
|
|
335
719
|
if (dataBreakpointsToStore.length) {
|
|
336
|
-
data.dataBreakpoints = dataBreakpointsToStore;
|
|
720
|
+
data.dataBreakpoints = dataBreakpointsToStore.map(({ origin }) => origin);
|
|
337
721
|
}
|
|
338
722
|
this.storage.setData('breakpoints', data);
|
|
339
723
|
}
|
|
@@ -343,25 +727,29 @@ tslib_1.__decorate([
|
|
|
343
727
|
(0, inversify_1.inject)(browser_1.StorageService),
|
|
344
728
|
tslib_1.__metadata("design:type", Object)
|
|
345
729
|
], BreakpointManager.prototype, "storage", void 0);
|
|
730
|
+
tslib_1.__decorate([
|
|
731
|
+
(0, inversify_1.inject)(browser_1.LabelProvider),
|
|
732
|
+
tslib_1.__metadata("design:type", browser_1.LabelProvider)
|
|
733
|
+
], BreakpointManager.prototype, "labelProvider", void 0);
|
|
734
|
+
tslib_1.__decorate([
|
|
735
|
+
(0, inversify_1.inject)(browser_1.OpenerService),
|
|
736
|
+
tslib_1.__metadata("design:type", Object)
|
|
737
|
+
], BreakpointManager.prototype, "openerService", void 0);
|
|
738
|
+
tslib_1.__decorate([
|
|
739
|
+
(0, inversify_1.inject)(common_1.CommandService),
|
|
740
|
+
tslib_1.__metadata("design:type", Object)
|
|
741
|
+
], BreakpointManager.prototype, "commandService", void 0);
|
|
742
|
+
tslib_1.__decorate([
|
|
743
|
+
(0, inversify_1.inject)(file_service_1.FileService),
|
|
744
|
+
tslib_1.__metadata("design:type", file_service_1.FileService)
|
|
745
|
+
], BreakpointManager.prototype, "fileService", void 0);
|
|
746
|
+
tslib_1.__decorate([
|
|
747
|
+
(0, inversify_1.postConstruct)(),
|
|
748
|
+
tslib_1.__metadata("design:type", Function),
|
|
749
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
750
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
751
|
+
], BreakpointManager.prototype, "init", null);
|
|
346
752
|
exports.BreakpointManager = BreakpointManager = BreakpointManager_1 = tslib_1.__decorate([
|
|
347
753
|
(0, inversify_1.injectable)()
|
|
348
754
|
], BreakpointManager);
|
|
349
|
-
function diff(prevs, nexts, toKey) {
|
|
350
|
-
const old = new Map(prevs.map(item => [toKey(item), item]));
|
|
351
|
-
const current = new Map(nexts.map(item => [toKey(item), item]));
|
|
352
|
-
const added = [];
|
|
353
|
-
const changed = [];
|
|
354
|
-
for (const [id, next] of current.entries()) {
|
|
355
|
-
const prev = old.get(id);
|
|
356
|
-
if (prev) {
|
|
357
|
-
changed.push(prev);
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
added.push(next);
|
|
361
|
-
}
|
|
362
|
-
old.delete(id);
|
|
363
|
-
}
|
|
364
|
-
const removed = Array.from(old.values());
|
|
365
|
-
return { added, removed, changed };
|
|
366
|
-
}
|
|
367
755
|
//# sourceMappingURL=breakpoint-manager.js.map
|