ereisch
ereisch

Reputation: 204

Can Visual Studio Code be launched directly into debug mode?

I would like to be able to use Visual Studio Code as a standalone debugger (e.g., a replacement for ddd) for a very large project. For reasons outside the scope of this question, I cannot start the program directly in VSCode (I want to debug a child process of another program). I have already downloaded and configured the Native Debug extension, and its "attach" feature works well, and I can configure a launch.json automatically from the parent process with the appropriate PID. My desire is to be able to fire up VSCode and have it immediately enter debug mode and auto-attach, in much the same way gdb or ddd would in attach mode.

Is it possible to script VSCode to do this, or is there an obscure config option I'm not seeing?

I've already tried messing around with the Eclipse standalone debugger, but from what I can tell it only supports C/C++, is very bloated (takes forever to launch), and (being a Java-based application) its install creates all kinds of side-effect files in a workspace folder, which doesn't make much sense for a standalone debugger.

Upvotes: 0

Views: 188

Answers (1)

ereisch
ereisch

Reputation: 204

Turns out you can enable this functionality with an extension, which needs to call

vscode.commands.executeCommand('workbench.action.debug.start');

There is already an extension someone wrote long ago that accomplishes this in a nutshell: https://marketplace.visualstudio.com/items?itemName=krizzdewizz.autorun

Upvotes: 0

Related Questions