(isolateRef: VMIsolateRef)
| 104 | } |
| 105 | |
| 106 | private async setLibrariesDebuggable(isolateRef: VMIsolateRef): Promise<void> { |
| 107 | if (this.debugSession.noDebug || !this.debugSession.vmService) |
| 108 | return; |
| 109 | |
| 110 | // Helpers to categories libraries as SDK/ExternalLibrary/not. |
| 111 | // Set whether libraries should be debuggable based on user settings. |
| 112 | const response = await this.debugSession.vmService.getIsolate(isolateRef.id); |
| 113 | const isolate: VMIsolate = response.result as VMIsolate; |
| 114 | const validDebugLibraries = isolate.libraries || []; |
| 115 | if (validDebugLibraries.length === 0) |
| 116 | return; |
| 117 | |
| 118 | const debugSession = this.debugSession; |
| 119 | function setLibrary(library: VMLibraryRef): Promise<any> { |
| 120 | if (!debugSession.vmService) |
| 121 | return Promise.resolve(true); |
| 122 | // Note: Condition is negated. |
| 123 | const shouldDebug = !( |
| 124 | // Inside here is shouldNotDebug! |
| 125 | (debugSession.isSdkLibrary(library.uri) && !debugSession.debugSdkLibraries) |
| 126 | || (debugSession.isExternalLibrary(library.uri) && !debugSession.debugExternalPackageLibraries)); |
| 127 | return debugSession.vmService.setLibraryDebuggable(isolate.id, library.id, shouldDebug); |
| 128 | } |
| 129 | |
| 130 | // We usually send these requests all concurrently, however on web this is not currently |
| 131 | // supported (https://github.com/dart-lang/webdev/issues/606) which results in a lot of |
| 132 | // bloat in the logs. Instead, send the first one, and if it works successfully, then |
| 133 | // do the whole lot. |
| 134 | const firstLib = validDebugLibraries[0]; |
| 135 | try { |
| 136 | await setLibrary(firstLib); |
| 137 | } catch (e) { |
| 138 | this.logger.info(errorString(e)); |
| 139 | return; |
| 140 | } |
| 141 | // Do all. |
| 142 | await Promise.all(validDebugLibraries.map(setLibrary)).catch((e) => this.logger.info(errorString(e))); |
| 143 | } |
| 144 | |
| 145 | // Just resends existing breakpoints for a single thread. |
| 146 | public async resendThreadBreakpoints(thread: ThreadInfo): Promise<void> { |
no test coverage detected