MCPcopy Create free account
hub / github.com/WebFreak001/code-debug / configurationDoneRequest

Method configurationDoneRequest

src/mibase.ts:321–388  ·  view source on GitHub ↗
(response: DebugProtocol.ConfigurationDoneResponse, args: DebugProtocol.ConfigurationDoneArguments)

Source from the content-addressed store, hash-verified

319 }
320
321 protected configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse, args: DebugProtocol.ConfigurationDoneArguments): void {
322 const promises: Thenable<any>[] = [];
323 let entryPoint: string | undefined = undefined;
324 let runToStart: boolean = false;
325 // Setup temporary breakpoint for the entry point if needed.
326 switch (this.initialRunCommand) {
327 case RunCommand.CONTINUE:
328 case RunCommand.NONE:
329 if (typeof this.stopAtEntry == 'boolean' && this.stopAtEntry)
330 entryPoint = "main"; // sensible default
331 else if (typeof this.stopAtEntry == 'string')
332 entryPoint = this.stopAtEntry;
333 break;
334 case RunCommand.RUN:
335 if (typeof this.stopAtEntry == 'boolean' && this.stopAtEntry) {
336 if (this.miDebugger.features.includes("exec-run-start-option"))
337 runToStart = true;
338 else
339 entryPoint = "main"; // sensible fallback
340 } else if (typeof this.stopAtEntry == 'string')
341 entryPoint = this.stopAtEntry;
342 break;
343 default:
344 throw new Error('Unhandled run command: ' + RunCommand[this.initialRunCommand]);
345 }
346 if (entryPoint)
347 promises.push(this.miDebugger.setEntryBreakPoint(entryPoint));
348 switch (this.initialRunCommand) {
349 case RunCommand.CONTINUE:
350 promises.push(this.miDebugger.continue().then(() => {
351 // Some debuggers will provide an out-of-band status that they are stopped
352 // when attaching (e.g., gdb), so the client assumes we are stopped and gets
353 // confused if we start running again on our own.
354 //
355 // If we don't send this event, the client may start requesting data (such as
356 // stack frames, local variables, etc.) since they believe the target is
357 // stopped. Furthermore, the client may not be indicating the proper status
358 // to the user (may indicate stopped when the target is actually running).
359 this.sendEvent(new ContinuedEvent(1, true));
360 }));
361 break;
362 case RunCommand.RUN:
363 promises.push(this.miDebugger.start(runToStart).then(() => {
364 this.started = true;
365 if (this.crashed)
366 this.handlePause(undefined);
367 }));
368 break;
369 case RunCommand.NONE: {
370 // Not all debuggers seem to provide an out-of-band status that they are stopped
371 // when attaching (e.g., lldb), so the client assumes we are running and gets
372 // confused when we don't actually run or continue. Therefore, we'll force a
373 // stopped event to be sent to the client (just in case) to synchronize the state.
374 const event: DebugProtocol.StoppedEvent = new StoppedEvent("pause", 1);
375 event.body.description = "paused on attach";
376 event.body.allThreadsStopped = true;
377 this.sendEvent(event);
378 break;

Callers

nothing calls this directly

Calls 5

handlePauseMethod · 0.95
setEntryBreakPointMethod · 0.80
toStringMethod · 0.80
continueMethod · 0.65
startMethod · 0.65

Tested by

no test coverage detected