Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.miDebugger.load(args.cwd, args.target, args.arguments).then(() => {
if (args.autorun)
args.autorun.forEach(command => {
this.miDebugger.sendUserInput(command);
});
this.sendResponse(response);
this.sendEvent(new InitializedEvent());
// start the program in the runtime - in reality wait for configurationDone
this.miDebugger.start();
}, err => {
this.sendErrorResponse(response, 103, `Failed to load MI Debugger: ${err.toString()}`)
const isolate: VMIsolate = response.result as VMIsolate;
this.threadManager.registerThread(
isolate,
isolate.runnable ? "IsolateRunnable" : "IsolateStart",
);
if (isolate.pauseEvent.kind.startsWith("Pause")) {
await this.handlePauseEvent(isolate.pauseEvent);
}
}));
// Set a timer for memory updates.
if (this.pollforMemoryMs)
setTimeout(() => this.pollForMemoryUsage(), this.pollforMemoryMs);
this.sendEvent(new InitializedEvent());
});
resolve();
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
this.sendResponse(response);
// now we are ready to accept breakpoints -> fire the initialized event to give UI a chance to set breakpoints
this.sendEvent(new InitializedEvent());
}
.then(() => {
// if we get this far, the debugger is connected and waiting for the resume command
// - set up some events
this.dbgr.on('bpstatechange', this, this.onBreakpointStateChange)
.on('bphit', this, this.onBreakpointHit)
.on('step', this, this.onStep)
.on('exception', this, this.onException)
.on('threadchange', this, this.onThreadChange)
.on('disconnect', this, this.onDebuggerDisconnect);
this.waitForConfigurationDone = $.Deferred();
// - tell the client we're initialised and ready for breakpoint info, etc
this.sendEvent(new InitializedEvent());
return this.waitForConfigurationDone;
})
.then(() => {
this.debugManager.connect(`ws://${args.host}:${args.port}/debug`, () => {
this.sendResponse(response);
this.sendEvent(new InitializedEvent());
});
}
});
this._debuggeeProc[DECODED_STDERR] = iconv.decodeStream(debuggeeEncoding);
this._debuggeeProc.stderr.pipe(this._debuggeeProc[DECODED_STDERR]);
this._debuggeeProc[DECODED_STDERR].on('data', (chunk) => {
this.sendEvent(new OutputEvent(chunk, 'stderr'));
});
this._debuggeeProc.on('exit', () => {
this.sendEvent(new TerminatedEvent());
});
}
};
if (args.noDebug) {
launchDebuggee();
this.sendEvent(new InitializedEvent());
return;
}
let ocdArgs = [];
if (args.cd) {
ocdArgs.push('-cd', args.cd);
}
if (args.includePath) {
args.includePath.forEach((path) => {
ocdArgs.push('-I', path);
});
}
this._remoteMode = !!args.socket;
this.events.emitStepStarted('Attach.ConfigureDebuggingSession.supportedDomains.install');
await this._supportedDomains.install();
this.events.emitStepStarted('Attach.ConfigureDebuggingSession.serviceComponents.install');
for (const serviceComponent of this._serviceComponents) {
this.events.emitStepStarted(`Attach.ConfigureDebuggingSession.${serviceComponent}.install`);
await serviceComponent.install();
}
this.events.emitStepStarted('Attach.ConfigureDebuggingSession.runIfWaitingForDebugger');
await this._runtimeStarter.runIfWaitingForDebugger();
this.events.emitStepStarted('Attach.ConfigureDebuggingSession.debuggeeInitializer');
await this._debuggeeInitializer.initialize();
this._session.sendEvent(new InitializedEvent());
this.events.emitStepCompleted('NotifyInitialized');
this.events.emitStepStarted('Attach.ConfigureDebuggingSession.waitForUserContentToLoad');
return this;
}
.then(() => {
this.sendResponse(response);
this.sendEvent(new vscode_debugadapter_1.InitializedEvent());
this.log('successfully connected\nconsole can be used to evaluate variables\nwaiting for breakpoint hit...');
});
}).catch(err => {
.configureValue(TYPES.communicator, communicator)
.configureValue(TYPES.EventsConsumedByConnectedCDA, new ConnectedCDAEventsCreator(communicator).create())
.configureValue(TYPES.CDTPClient, chromeConnection.api)
.configureValue(TYPES.ISession, new DelayMessagesUntilInitializedSession(new DoNotPauseWhileSteppingSession(this._session)))
.configureValue(TYPES.BasePathTransformer, new pathTransformerClass())
.configureValue(TYPES.BaseSourceMapTransformer, new sourceMapTransformerClass())
.configureValue(TYPES.ChromeConnection, chromeConnection)
.configureValue(TYPES.ConnectedCDAConfiguration, new ConnectedCDAConfiguration(this._extensibilityPoints,
this.parseLoggingConfiguration(args),
this._session,
this._clientCapabilities,
this._chromeConnectionClass,
scenarioType,
args));
this._session.sendEvent(new InitializedEvent());
return di.createClassWithDI(ConnectedCDA);
}
if (!isStreamingConnected) {
return this.sendResponse(response);
}
const sessionId = await this.mySessionService
.forProject(args.sfdxProject)
.withUserFilter(this.toCommaSeparatedString(args.userIdFilter))
.withEntryFilter(args.entryPointFilter)
.withRequestFilter(this.toCommaSeparatedString(args.requestTypeFilter))
.start();
if (this.mySessionService.isConnected()) {
response.success = true;
this.printToDebugConsole(
nls.localize('session_started_text', sessionId)
);
this.sendEvent(new InitializedEvent());
this.resetIdleTimer();
} else {
this.errorToDebugConsole(
`${nls.localize('command_error_help_text')}:${os.EOL}${sessionId}`
);
}
} catch (error) {
this.tryToParseSfdxError(response, error);
}
this.sendResponse(response);
}