MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / hitBreakpoint

Method hitBreakpoint

src/test/debug_client_ms.ts:497–542  ·  view source on GitHub ↗

* Returns a promise that will resolve if a configurable breakpoint has been hit within some time * and the event's reason and line number was asserted. * The promise will be rejected if a timeout occurs, the assertions fail, or if the requests fails.

(launchArgs: any, location: ILocation, expectedStopLocation?: IPartialLocation, expectedBPLocation?: IPartialLocation, skipWaiting = false)

Source from the content-addressed store, hash-verified

495 * The promise will be rejected if a timeout occurs, the assertions fail, or if the requests fails.
496 */
497 public hitBreakpoint(launchArgs: any, location: ILocation, expectedStopLocation?: IPartialLocation, expectedBPLocation?: IPartialLocation, skipWaiting = false): Promise<any> {
498
499 // If we're an attach request, we'll automatically pause at startup, so we need to wait for that then resume before asserting
500 // the stop.
501 const setupBreakpointWait = launchArgs.request === "attach"
502 ? async () => {
503 const event = await this.waitForEvent("stopped", "hitBreakpoint") as DebugProtocol.StoppedEvent;
504 // Allow either step (old DC DA) or entry (SDK DA).
505 if (event.body.reason !== "step")
506 assert.equal(event.body.reason, "entry");
507
508 // We don't need to send a resume, as this is done in the launch method; we can just wait.
509 return this.assertStoppedLocation('breakpoint', expectedStopLocation || location);
510 }
511 : () => this.assertStoppedLocation('breakpoint', expectedStopLocation || location);
512
513 return Promise.all([
514
515 this.waitForEvent('initialized', 'hitBreakpoint').then(event => {
516 return this.setBreakpointsRequest({
517 lines: [location.line],
518 breakpoints: [{ line: location.line, column: location.column }],
519 source: { path: location.path }
520 });
521 }).then(response => {
522
523 const bp = response.body.breakpoints[0];
524
525 if (typeof location.verified === 'boolean')
526 assert.equal(bp.verified, location.verified, 'breakpoint verification mismatch: verified');
527
528 const actualLocation: ILocation = {
529 column: bp.column,
530 line: bp.line!,
531 path: bp.source && bp.source.path
532 };
533 this.assertPartialLocationsEqual(actualLocation, expectedBPLocation || location);
534
535 return this.configurationDone();
536 }),
537
538 skipWaiting ? Promise.resolve(undefined) : setupBreakpointWait(),
539
540 this.launch(launchArgs),
541 ]);
542 }
543}

Calls 6

waitForEventMethod · 0.95
assertStoppedLocationMethod · 0.95
setBreakpointsRequestMethod · 0.95
configurationDoneMethod · 0.95
launchMethod · 0.95

Tested by

no test coverage detected