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

Method registerThread

src/debug/threads.ts:19–47  ·  view source on GitHub ↗
(ref: VMIsolateRef, eventKind: string)

Source from the content-addressed store, hash-verified

17 constructor(private readonly logger: Logger, public readonly debugSession: DartDebugSession) { }
18
19 public async registerThread(ref: VMIsolateRef, eventKind: string): Promise<void> {
20 let thread = this.getThreadInfoFromRef(ref);
21
22 if (!thread) {
23 thread = new ThreadInfo(this, ref, this.nextThreadId);
24 this.nextThreadId++;
25 this.threads.push(thread);
26
27 // If this is the first time we've seen it, fire an event
28 this.debugSession.sendEvent(new ThreadEvent("started", thread.num));
29
30 if (this.hasConfigurationDone)
31 thread.receivedConfigurationDone();
32 }
33
34 // If it's just become runnable (IsolateRunnable), then set breakpoints.
35 if (eventKind === "IsolateRunnable" && !thread.runnable) {
36 thread.runnable = true;
37
38 if (this.debugSession.vmService) {
39 await Promise.all([
40 this.setThreadExceptionPauseMode(thread.ref, this.exceptionMode),
41 this.setLibrariesDebuggable(thread.ref),
42 this.resendThreadBreakpoints(thread),
43 ]);
44 thread.setInitialBreakpoints();
45 }
46 }
47 }
48
49 private async setThreadExceptionPauseMode(isolateRef: VMIsolateRef, mode: VmExceptionMode): Promise<void> {
50 if (!this.debugSession?.vmService)

Callers 2

initDebuggerFunction · 0.80
handleIsolateEventFunction · 0.80

Calls 7

getThreadInfoFromRefMethod · 0.95
sendEventMethod · 0.80
setInitialBreakpointsMethod · 0.80

Tested by

no test coverage detected