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