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

Method setInstructionBreakpointsRequest

src/gdb.ts:2132–2188  ·  view source on GitHub ↗
(
        r: DebugProtocol.SetInstructionBreakpointsResponse,
        a: DebugProtocol.SetInstructionBreakpointsArguments, request?: DebugProtocol.Request)

Source from the content-addressed store, hash-verified

2130 }
2131
2132 protected setInstructionBreakpointsRequest(
2133 r: DebugProtocol.SetInstructionBreakpointsResponse,
2134 a: DebugProtocol.SetInstructionBreakpointsArguments, request?: DebugProtocol.Request): Promise<void> {
2135 const doit = (
2136 response: DebugProtocol.SetInstructionBreakpointsResponse,
2137 args: DebugProtocol.SetInstructionBreakpointsArguments,
2138 pendContinue: PendingContinue): Promise<void> => {
2139 return new Promise<void>(async (resolve) => {
2140 const createBreakpoints = async () => {
2141 try {
2142 const currentBreakpoints = Array.from(this.instrBreakpointMap.keys());
2143 this.instrBreakpointMap.clear();
2144
2145 await this.miDebugger.removeBreakpoints(currentBreakpoints);
2146
2147 const all: Array<Promise<OurInstructionBreakpoint | MIError>> = [];
2148 args.breakpoints.forEach((brk) => {
2149 const addr = parseInt(brk.instructionReference) + brk.offset || 0;
2150 const bpt: OurInstructionBreakpoint = { ...brk, number: -1, address: addr };
2151 all.push(this.miDebugger.addInstrBreakPoint(bpt).catch((err: MIError) => err));
2152 });
2153
2154 const brkpoints = await Promise.all(all);
2155
2156 response.body = {
2157 breakpoints: brkpoints.map((bp) => {
2158 if (bp instanceof MIError) {
2159 return {
2160 verified: false,
2161 message: bp.message
2162 } as DebugProtocol.Breakpoint;
2163 }
2164
2165 this.instrBreakpointMap.set(bp.number, bp);
2166 return {
2167 id: bp.number,
2168 verified: true
2169 };
2170 })
2171 };
2172
2173 this.sendResponse(response);
2174 }
2175 catch (msg) {
2176 this.sendErrorResponse(response, 9, msg.toString());
2177 }
2178
2179 this.continueIfNoMore(pendContinue);
2180 resolve();
2181 };
2182
2183 await this.doPauseExecContinue(createBreakpoints, pendContinue);
2184 });
2185 };
2186
2187 return this.allBreakPointsQ.add(doit, r, a);
2188 }
2189

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected