microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

Feature request: start to debug c++ directly from command line. #3502

Open kgfly opened 5 years ago

kgfly commented 5 years ago

Type: Debugger Input information below

This a feature request. Currently, to debug the exe or attach a process, I've to setup launch.json, which is very tedious if you just want to do some quick very verification.

Request: start to debug directly from command line, eg

code -e cpp -d ./a.out arg1 arg2, argN: to debug a.out with arg1 and arg2.... argN code -e cpp -p 12345: attach process 12345.

"-e cpp" means "pass the following parameters to vscode-cpptools extension."

As a comparison:

In visual studio, you can devenv.exe /debugexe a.exe

Eclipse has a plugin: https://github.com/eclipse-cdt/cdt/blob/master/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh, which allow you to start debug from command line.

Emacs (which is close to VScode since both VScode and emacs are editors while VS/Eclipse are IDE, you can pass some parameters https://stackoverflow.com/questions/5997309/start-emacs-gdb-from-command-line to start debugging directly.

WardenGnaw commented 5 years ago

This would be a feature for VS Code itself. There is no commandline option to pass to the extension at the moment. Please submit an issue at https://github.com/Microsoft/vscode/issues

kgfly commented 5 years ago

I think it need works from both vscode and extensions. I filed one in vscode. https://github.com/Microsoft/vscode/issues/72726

WardenGnaw commented 5 years ago

@9527KGG I agree that there may be work on our extension side. However, we are blocked until VS Code has a way to communicate to the extension that it needs to launch/attach a process from the commandline.

kgfly commented 5 years ago

Some one suggested a similar one but not for c++ though: https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-debug-launcher

kgfly commented 5 years ago

@WardenGnaw , https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-debug-launcher mention that they can debug script by running "vscode://fabiospampinato.vscode-debug-launcher/\<command>?args=\<arg1>,\<arg2>,\<argN>". So can vscode-cpptools have similar feature? It does not require any work from vscode.

WardenGnaw commented 5 years ago

@9527KGG Thanks for letting us know.

For this feature, this would require implementing VS Code's UriHandler which should call startDebugging with the given parameters.

eternalphane commented 5 years ago

Hi @9527KGG, why you close this issue?

kgfly commented 5 years ago

Hi @9527KGG, why you close this issue?

because I gave up :)

eternalphane commented 5 years ago

Hi @9527KGG, why you close this issue?

because I gave up :)

then please reopen this issue to mark it as unresolved (and hopefully someone may create a pr for it ˊ_>ˋ )

weiguozhi commented 2 years ago

This feature is also useful to me. Any progress in the past two years?

I saw many similar feature requests were marked as duplication of https://github.com/microsoft/vscode/issues/10979, and 10979 was closed recently. But in 10979 I can't find anything useful to a task described in this issue.