(ref: VMIsolateRef, eventKind: string)
| 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) |
no test coverage detected