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

Method add

src/gdb.ts:165–189  ·  view source on GitHub ↗
(
        // For the varargs, extra can be any set of args but the first arg if used, is of type PendContinue
        functor: (response: RespType, args: ArgsType, ...extra: any[]) => Promise<void>,
        response: RespType, args: ArgsType, ...extra)

Source from the content-addressed store, hash-verified

163 public pendedContinue = new PendingContinue(false, this.haveMore.bind(this));
164 constructor(private alwaysResolve = true) {}
165 public add(
166 // For the varargs, extra can be any set of args but the first arg if used, is of type PendContinue
167 functor: (response: RespType, args: ArgsType, ...extra: any[]) => Promise<void>,
168 response: RespType, args: ArgsType, ...extra): Promise<void> {
169 return new Promise<void>(async (resolve, reject) => {
170 this.queue.push(new VSCodeRequest<RespType, ArgsType>(functor, response, args, resolve, reject, extra));
171 while (!this.queueBusy && (this.queue.length > 0)) {
172 this.queueBusy = true;
173 const obj = this.queue.shift();
174 try {
175 const p = obj.functor(obj.response, obj.args, this.pendedContinue, ...obj.extra);
176 await p;
177 obj.resolve();
178 }
179 catch (e) {
180 if (this.alwaysResolve) {
181 obj.resolve();
182 } else {
183 obj.reject(e);
184 }
185 }
186 this.queueBusy = false;
187 }
188 });
189 }
190
191 public haveMore(): boolean {
192 return this.queue.length > 0;

Callers 9

EmitAllocatedMethod · 0.45
launchAttachInitMethod · 0.45
handleThreadCreatedMethod · 0.45
setBreakPointsRequestMethod · 0.45
evaluateRequestMethod · 0.45
evaluateRequestMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected