MCPcopy Create free account
hub / github.com/Marus/cortex-debug / setDataBreakpointsRequest

Method setDataBreakpointsRequest

src/gdb.ts:2240–2301  ·  view source on GitHub ↗
(
        r: DebugProtocol.SetDataBreakpointsResponse,
        a: DebugProtocol.SetDataBreakpointsArguments)

Source from the content-addressed store, hash-verified

2238 }
2239
2240 protected setDataBreakpointsRequest(
2241 r: DebugProtocol.SetDataBreakpointsResponse,
2242 a: DebugProtocol.SetDataBreakpointsArguments): Promise<void> {
2243 const doit = (
2244 response: DebugProtocol.SetDataBreakpointsResponse,
2245 args: DebugProtocol.SetDataBreakpointsArguments,
2246 pendContinue: PendingContinue): Promise<void> => {
2247 return new Promise<void>(async (resolve) => {
2248 const createBreakpoints = async () => {
2249 try {
2250 const currentBreakpoints = Array.from(this.dataBreakpointMap.keys());
2251 this.dataBreakpointMap.clear();
2252
2253 await this.miDebugger.removeBreakpoints(currentBreakpoints);
2254
2255 const all: Array<Promise<OurDataBreakpoint | MIError>> = [];
2256
2257 args.breakpoints.forEach((brk) => {
2258 const bkp: OurDataBreakpoint = { ...brk };
2259 all.push(this.miDebugger.addDataBreakPoint(bkp).catch((err: MIError) => err));
2260 });
2261
2262 const brkpoints = await Promise.all(all);
2263
2264 response.body = {
2265 breakpoints: brkpoints.map((bp) => {
2266 if (bp instanceof MIError) {
2267 /* Failed breakpoints should be reported with
2268 * verified: false, so they can be greyed out
2269 * in the UI. The attached message will be
2270 * presented as a tooltip.
2271 */
2272 return {
2273 verified: false,
2274 message: bp.message
2275 } as DebugProtocol.Breakpoint;
2276 }
2277
2278 this.dataBreakpointMap.set(bp.number, bp);
2279 return {
2280 id: bp.number,
2281 verified: true
2282 };
2283 })
2284 };
2285
2286 this.sendResponse(response);
2287 }
2288 catch (msg) {
2289 this.sendErrorResponse(response, 9, msg.toString());
2290 }
2291
2292 this.continueIfNoMore(pendContinue);
2293 resolve();
2294 };
2295
2296 await this.doPauseExecContinue(createBreakpoints, pendContinue);
2297 });

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected