How to use the vscode-debugadapter.ThreadEvent function in vscode-debugadapter

To help you get started, we’ve selected a few vscode-debugadapter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github konstellation-io / science-toolkit / vscode / extensions / ms-vscode.go-0.13.0 / out / src / debugAdapter / goDebug.js View on Github external
updateGoroutinesList(goroutines) {
        // Assume we need to stop all the threads we saw before...
        const needsToBeStopped = new Set();
        this.goroutines.forEach((id) => needsToBeStopped.add(id));
        for (const goroutine of goroutines) {
            // ...but delete from list of threads to stop if we still see it
            needsToBeStopped.delete(goroutine.id);
            if (!this.goroutines.has(goroutine.id)) {
                // Send started event if it's new
                this.sendEvent(new vscode_debugadapter_1.ThreadEvent('started', goroutine.id));
            }
            this.goroutines.add(goroutine.id);
        }
        // Send existed event if it's no longer there
        needsToBeStopped.forEach((id) => {
            this.sendEvent(new vscode_debugadapter_1.ThreadEvent('exited', id));
            this.goroutines.delete(id);
        });
    }
    setBreakPoints(response, args) {
github Dart-Code / Dart-Code / src / debug / threads.ts View on Github external
public async registerThread(ref: VMIsolateRef, eventKind: string): Promise {
		let thread = this.getThreadInfoFromRef(ref);

		if (!thread) {
			thread = new ThreadInfo(this, ref, this.nextThreadId);
			this.nextThreadId++;
			this.threads.push(thread);

			// If this is the first time we've seen it, fire an event
			this.debugSession.sendEvent(new ThreadEvent("started", thread.num));

			if (this.hasConfigurationDone)
				thread.receivedConfigurationDone();
		}

		// If it's just become runnable (IsolateRunnable), then set breakpoints.
		if (eventKind === "IsolateRunnable" && !thread.runnable) {
			thread.runnable = true;

			if (this.debugSession.observatory) {
				await Promise.all([
					this.debugSession.observatory.setExceptionPauseMode(thread.ref.id, this.exceptionMode),
					this.setLibrariesDebuggable(thread.ref),
					this.resetBreakpoints(),
				]);
				thread.setInitialBreakpoints();
github felixfbecker / vscode-php-debug / src / phpDebug.ts View on Github external
private _checkStatus(response: xdebug.StatusResponse): void {
        const connection = response.connection;
        if (response.status === 'stopping') {
            connection.sendStopCommand().then(response => this._checkStatus(response));
        } else if (response.status === 'stopped') {
            this._connections.delete(connection.id);
            this.sendEvent(new vscode.ThreadEvent('exited', connection.id));
            connection.close();
        } else if (response.status === 'break') {
            // StoppedEvent reason can be 'step', 'breakpoint', 'exception' or 'pause'
            let stoppedEventReason: string;
            let exceptionText: string;
            if (response.exception) {
                stoppedEventReason = 'exception';
                exceptionText = response.exception.name + ': ' + response.exception.message; // this seems to be ignored currently by VS Code
            } else if (response.command.indexOf('step') === 0) {
                stoppedEventReason = 'step';
            } else {
                stoppedEventReason = 'breakpoint';
            }
            this.sendEvent(new vscode.StoppedEvent(stoppedEventReason, connection.id, exceptionText));
        }
    }
github forcedotcom / salesforcedx-vscode / packages / salesforcedx-apex-debugger / src / adapter / apexDebug.ts View on Github external
private handleRequestFinished(message: DebuggerMessage): void {
    const threadId = this.getThreadIdFromRequestId(message.sobject.RequestId);
    if (threadId !== undefined) {
      this.logEvent(message);
      this.requestThreads.delete(threadId);
      this.sendEvent(new ThreadEvent('exited', threadId));

      // cleanup everything that's no longer necessary after all request finished
      if (this.requestThreads.size === 0) {
        this.log(
          TRACE_CATEGORY_VARIABLES,
          'handleRequestFinished: clearing variable cache'
        );
        this.stackFrameInfos.reset();
        this.variableHandles.reset();
        this.variableContainerReferenceByApexId.clear();
      }
    }
  }
github Dart-Code / Dart-Code / src / debug / threads.ts View on Github external
public handleIsolateExit(ref: VMIsolateRef) {
		const threadInfo = this.getThreadInfoFromRef(ref);
		if (threadInfo) {
			this.debugSession.sendEvent(new ThreadEvent("exited", threadInfo.num));
			this.threads.splice(this.threads.indexOf(threadInfo), 1);
			this.removeStoredData(threadInfo);
		}
	}
}
github Marus / cortex-debug / src / gdb.ts View on Github external
protected handleThreadCreated(info: { threadId: number, threadGroupId: string }) {
        if (!this.activeThreadIds.has(info.threadId)) {
            if (traceThreads) {
                this.handleMsg('log', `**** Thread created ${info.threadId}\n`);
            }
            this.activeThreadIds.add(info.threadId);
            this.sendEvent(new ThreadEvent('started', info.threadId));
        } else {
            this.handleMsg('log', `Thread Error: GDB trying to create thread '${info.threadId}' that already exists`);
        }
    }
github SqrTT / prophet / out / mockDebug.js View on Github external
activeThreads.forEach(activeThread => {
                        if (this.threadsArray.indexOf(activeThread.id) === -1) {
                            this.sendEvent(new vscode_debugadapter_1.ThreadEvent('started', activeThread.id));
                            this.sendEvent(new vscode_debugadapter_1.StoppedEvent('breakpoint', activeThread.id));
                            this.threadsArray.push(activeThread.id);
                        }
                    });
                }
github adelphes / android-dev-ext / src / debugMain.js View on Github external
.then((threadinfos) => {
                        var ti = threadinfos[0], t = this.getThread(ti.threadid), event = new ThreadEvent();
                        t.name = ti.name;
                        event.body = { reason:'started', threadId: t.vscode_threadid };
                        this.sendEvent(event);
                    })
                    .always(() => this.dbgr.resumethread(e.threadid));
github DonJayamanne / pythonVSCode / src / client / debugger / Main.ts View on Github external
private onPythonThreadCreated(pyThread: IPythonThread) {
        this.sendEvent(new ThreadEvent("started", pyThread.Int32Id));
    }
    private onStepCompleted(pyThread: IPythonThread) {