How to use vscode-debugadapter - 10 common examples

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 facebookarchive / atom-ide-ui / modules / atom-ide-debugger-python / VendorLib / vs-py-debugger / out / client / debugger / mainV2.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
        vscode_debugadapter_1.logger.init(core_utils_1.noop, path.join(__dirname, '..', '..', '..', 'experimental_debug.log'));
        const serviceContainer = serviceRegistry_1.initializeIoc();
        const protocolMessageWriter = serviceContainer.get(types_2.IProtocolMessageWriter);
        try {
            // debugger;
            const debugManager = new DebugManager(serviceContainer);
            yield debugManager.start();
        }
        catch (err) {
            const message = `Debugger Error: ${err && err.message ? err.message : err.toString()}`;
            const details = [message, err && err.name ? err.name : '', err && err.stack ? err.stack : ''].join(os_1.EOL);
            vscode_debugadapter_1.logger.error(`${message}${os_1.EOL}${details}`);
            // Notify the user.
            protocolMessageWriter.write(process.stdout, new messages_1.Event('error', message));
            protocolMessageWriter.write(process.stdout, new vscode_debugadapter_1.OutputEvent(`${message}${os_1.EOL}${details}`, 'stderr'));
        }
    });
}
github indiejames / vscode-clojure-debug / src / clojureDebug.ts View on Github external
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);
github indiejames / vscode-clojure-debug / src / clojureDebug.ts View on Github external
console.log("GOT VARIABLES");
			console.log(result);
			var variables = result[0]["vars"];
			var frameArgs = variables[0];
			var frameLocals = variables[1];
			var argScope = frameArgs.map((v: any) : any => {
				let val = {name: v["name"], value: v["value"], variablesReference: 0};
				return val;
			});
			var localScope = frameLocals.map((v: any) : any => {
				let val = {name: v["name"], value: v["value"], variablesReference: 0};
				return val;
			});
			const scopes = new Array();
			scopes.push(new Scope("Local", this._variableHandles.create(localScope), false));
			scopes.push(new Scope("Argument", this._variableHandles.create(argScope), false));
			// scopes.push(new Scope("Global", this._variableHandles.create("global_" + frameReference), true));

			response.body = {
				scopes: scopes
			};
			debug.sendResponse(response);
		});
	}
github DonJayamanne / pythonVSCode / src / client / debugger / debugAdapter / main.ts View on Github external
process.on('uncaughtException', (err: Error) => {
    logger.error(`Uncaught Exception: ${err && err.message ? err.message : ''}`);
    logger.error(err && err.name ? err.name : '');
    logger.error(err && err.stack ? err.stack : '');
    // Catch all, incase we have string exceptions being raised.
    logger.error(err ? err.toString() : '');
    // Wait for 1 second before we die, we need to ensure errors are written to the log file.
    setTimeout(() => process.exit(-1), 100);
});
github DonJayamanne / pythonVSCode / src / client / debugger / debugAdapter / main.ts View on Github external
process.on('uncaughtException', (err: Error) => {
    logger.error(`Uncaught Exception: ${err && err.message ? err.message : ''}`);
    logger.error(err && err.name ? err.name : '');
    logger.error(err && err.stack ? err.stack : '');
    // Catch all, incase we have string exceptions being raised.
    logger.error(err ? err.toString() : '');
    // Wait for 1 second before we die, we need to ensure errors are written to the log file.
    setTimeout(() => process.exit(-1), 100);
});
github DonJayamanne / pythonVSCode / src / client / debugger / debugAdapter / main.ts View on Github external
process.on('uncaughtException', (err: Error) => {
    logger.error(`Uncaught Exception: ${err && err.message ? err.message : ''}`);
    logger.error(err && err.name ? err.name : '');
    logger.error(err && err.stack ? err.stack : '');
    // Catch all, incase we have string exceptions being raised.
    logger.error(err ? err.toString() : '');
    // Wait for 1 second before we die, we need to ensure errors are written to the log file.
    setTimeout(() => process.exit(-1), 100);
});
github DonJayamanne / pythonVSCode / src / client / debugger / Main.ts View on Github external
process.on('uncaughtException', (err: Error) => {
    logger.error(`Uncaught Exception: ${err && err.message ? err.message : ''}`);
    logger.error(err && err.name ? err.name : '');
    logger.error(err && err.stack ? err.stack : '');
    // Catch all, incase we have string exceptions being raised.
    logger.error(err ? err.toString() : '');
    // Wait for 1 second before we die, we need to ensure errors are written to the log file.
    setTimeout(() => process.exit(-1), 1000);
});
github DonJayamanne / pythonVSCode / src / client / debugger / debugAdapter / main.ts View on Github external
async function startDebugger() {
    logger.init(noop, path.join(EXTENSION_ROOT_DIR, `debug${process.pid}.log`));
    const serviceContainer = initializeIoc();
    const protocolMessageWriter = serviceContainer.get(IProtocolMessageWriter);
    try {
        // debugger;
        const debugManager = new DebugManager(serviceContainer);
        await debugManager.start();
    } catch (err) {
        const message = `Debugger Error: ${err && err.message ? err.message : err.toString()}`;
        const details = [message, err && err.name ? err.name : '', err && err.stack ? err.stack : ''].join(EOL);
        logger.error(`${message}${EOL}${details}`);

        // Notify the user.
        protocolMessageWriter.write(process.stdout, new Event('error', message));
        protocolMessageWriter.write(process.stdout, new OutputEvent(`${message}${EOL}${details}`, 'stderr'));
    }
}
github forcedotcom / salesforcedx-vscode / packages / salesforcedx-apex-debugger / src / adapter / apexDebug.ts View on Github external
private setupLogger(args: LaunchRequestArguments): void {
    if (typeof args.trace === 'boolean') {
      this.trace = args.trace ? [TRACE_ALL] : undefined;
      this.traceAll = args.trace;
    } else if (typeof args.trace === 'string') {
      this.trace = args.trace.split(',').map(category => category.trim());
      this.traceAll = this.trace.indexOf(TRACE_ALL) >= 0;
    }
    if (this.trace && this.trace.indexOf(TRACE_CATEGORY_PROTOCOL) >= 0) {
      // only log debug adapter protocol if 'protocol' tracing flag is set, ignore traceAll here
      logger.setup(Logger.LogLevel.Verbose, false);
    } else {
      logger.setup(Logger.LogLevel.Stop, false);
    }
  }
github area9innovation / flow9 / resources / vscode / flow / src / flowcpp_adapter.ts View on Github external
import { LoggingDebugSession, Logger, logger, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles, DebugSession, Breakpoint } from 'vscode-debugadapter';
import { DebugProtocol } from 'vscode-debugprotocol';
import { Variable, Stack, VariableObject, MIError } from './backend/backend';
import { expandValue } from './backend/gdb_expansion';
import { MI2 } from './backend/flowcpp_runtime';


logger.setup(Logger.LogLevel.Verbose, true);

process.on("unhandledRejection", (error) => {
	console.error(error); // This prints error with stack included (as for normal errors)
	throw error; // Following best practices re-throw error and let the process exit with error code
});

export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
	cwd: string;
	target: string;
	runner_path: string;
	env: any;
	debugger_args: string;
	arguments: string;
	autorun: string[];
	print_calls: boolean;
	showDevDebugOutput: boolean;