Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._debuggerState = DebuggerState.LAUNCH_COMPLETE;
var debug = this;
this._connection.send({op: 'list-threads'}, (err: any, result: any) => {
console.log(result);
this.updateThreads(result[0]["threads"]);
console.log("Got threads");
});
if (args.stopOnEntry) {
this._currentLine = 1;
this.sendResponse(response);
// we stop on the first line - TODO need to figure out what thread this would be and if we even want to support this
this.sendEvent(new StoppedEvent("entry", ClojureDebugSession.THREAD_ID));
} else {
// we just start to run until we hit a breakpoint or an exception
this.continueRequest(response, { threadId: ClojureDebugSession.THREAD_ID });
}
}
if (this._debuggerState == DebuggerState.DEBUGGER_ATTACHED) {
this._debuggerState = DebuggerState.REPL_READY;
}
if (this._debuggerState == DebuggerState.REPL_STARTED) {
this._debuggerState = DebuggerState.DEBUGGER_ATTACHED;
}
this.handleREPLOutput(output);
private onPythonException(pyThread: IPythonThread, ex: IPythonException) {
this.sendEvent(new StoppedEvent("exception", pyThread.Id, `${ex.TypeName}, ${ex.Description}`));
this.sendEvent(new OutputEvent(`${ex.TypeName}, ${ex.Description}\n`, "stderr"));
// this.sendEvent(new StoppedEvent("breakpoint", pyThread.Id));
}
private onPythonThreadExited(pyThread: IPythonThread) {
for (let goroutine of goroutines) {
// ...but delete from list of threads to stop if we still see it
needsToBeStopped.delete(goroutine.id);
if (!this.threads.has(goroutine.id)) {
// Send started event if it's new
this.sendEvent(new ThreadEvent('started', goroutine.id));
}
this.threads.add(goroutine.id);
}
// Send existed event if it's no longer there
needsToBeStopped.forEach(id => {
this.sendEvent(new ThreadEvent('exited', id));
this.threads.delete(id);
});
this.sendEvent(new StoppedEvent(reason, this.debugState.currentGoroutine.id));
log('StoppedEvent("' + reason + '")');
});
}
private onBreakpointHit(pyThread: IPythonThread, breakpointId: number) {
if (this.registeredBreakpoints.has(breakpointId)) {
this.sendEvent(new StoppedEvent("breakpoint", pyThread.Id));
}
else {
this.pythonProcess.SendResumeThread(pyThread.Id);
}
}
protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): void {
private reportStopped(reason: string, contextId: number): void {
log.debug(`sending 'stopped' to VS Code`);
this.sendEvent(new StoppedEvent(reason, contextId));
}
}
function callBackFun(isstep, isover) {
if (isstep) {
that.sendEvent(new StoppedEvent("step", 1))
}
}
try {
this.sendResponse(response);
const prevNumOfFrames = this.logContext.getNumOfFrames();
while (this.logContext.hasLogLines()) {
this.logContext.updateFrames();
const curNumOfFrames = this.logContext.getNumOfFrames();
if (
(stepType === Step.Over &&
curNumOfFrames !== 0 &&
curNumOfFrames <= prevNumOfFrames) ||
(stepType === Step.In && curNumOfFrames >= prevNumOfFrames) ||
(stepType === Step.Out &&
curNumOfFrames !== 0 &&
curNumOfFrames < prevNumOfFrames)
) {
return this.sendEvent(
new StoppedEvent('step', ApexReplayDebug.THREAD_ID)
);
}
if (this.shouldStopForBreakpoint()) {
return;
}
}
this.sendEvent(new TerminatedEvent());
}
await this.evaluateAndSendErrors(thread, printCommand);
}
}
} else if (kind === "PauseBreakpoint") {
reason = "step";
} else if (kind === "PauseException") {
reason = "exception";
exceptionText =
event.exception
? await this.fullValueAsString(event.isolate, event.exception)
: undefined;
}
thread.handlePaused(event.atAsyncSuspension, event.exception);
if (shouldRemainedStoppedOnBreakpoint) {
this.sendEvent(new StoppedEvent(reason, thread.num, exceptionText));
} else {
thread.resume();
}
}
}
_handleBreakpointHitEvent(breakpointId: string): Promise {
this.sendEvent(new StoppedEvent('Breakpoint hit', THREAD_ID));
return Promise.resolve();
}
if (Array.isArray(result.consoleOutput) && result.consoleOutput.length > 0) {
this.sendEvent(new OutputEvent(result.consoleOutput.join("\n") + "\n"));
}
if (Array.isArray(result.errors) && result.errors.length > 0) {
this.sendErrorResponse(response, 1, result.errors.join("\n"));
this.sendEvent(new StoppedEvent("exception", PythonDebugSession.THREAD_ID));
return;
}
if (result.completed === true) {
this.sendResponse(response);
this.sendEvent(new TerminatedEvent());
return;
}
this.sendResponse(response);
this.sendEvent(new StoppedEvent(commandName, PythonDebugSession.THREAD_ID));
}