microsoft / microsoft/vscode-cpptools

Allow "args" to be specified as a single string.

Open
#1,210 19 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger Feature Request
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

When configuring the launch.json file, it expects args to be an array of strings that are passed to the process, where each item in the array is one argument. This is extremely user-unfriendly when dealing with long command lines. For example, here is my use case.

Problem: I want to debug clang when you run clang-cl.exe /c foo.cpp

Step 1: Run clang-cl.exe /c foo.cpp -###

E:\src\llvmbuild\ninja>bin\clang-cl /c foo.cpp -###
clang version 6.0.0
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: E:\src\llvmbuild\ninja\bin
 "E:\\src\\llvmbuild\\ninja\\bin\\clang-cl.exe" "-cc1" "-triple" "i686-pc-windows-msvc19.11.25508" "-emit-obj"
"-mrelax-all" "-mincremental-linker-compatible" "-disable-free" "-main-file-name" "foo.cpp" "-mrelocation-model"
"static" "-mthread-model" "posix" "-mdisable-fp-elim" "-relaxed-aliasing" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-target-cpu" "pentium4" "-D_MT" "-flto-visibility-public-std" "--dependent-lib=libcmt"
"--dependent-lib=oldnames" "-stack-protector" "2" "-fms-volatile" "-fdiagnostics-format" "msvc"
"-dwarf-column-info" "-debugger-tuning=gdb" "-coverage-notes-file" "E:\\src\\llvmbuild\\ninja\\foo.gcno" "-resource-dir" "E:\\src\\llvmbuild\\ninja\\lib\\clang\\6.0.0"
"-internal-isystem" "E:\\src\\llvmbuild\\ninja\\lib\\clang\\6.0.0\\include"
"-internal-isystem" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Tools\\MSVC\\14.11.25503\\ATLMFC\\include"
"-internal-isystem" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Tools\\MSVC\\14.11.25503\\include"
"-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um"
"-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\ucrt"
"-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\shared" 
"-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\um"
"-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\winrt"
"-fdeprecated-macro" "-fdebug-compilation-dir" "E:\\src\\llvmbuild\\ninja" "-ferror-limit" "19"
"-fmessage-length" "120" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility"
"-fms-compatibility-version=19.11.25508" "-std=c++14" "-fdelayed-template-parsing"
"-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "foo.obj" "-x" "c++" "foo.cpp"

Step 2: Take the resulting command line, and debug that. this is necessary because the original invocation actually spawns a child process whose command line is the second invocation, and it is that child invocation that actually needs to be debugged.

In order for me to do this, I have to manually add commas to this huge list of command line arguments.

Worse, if I change one little option to the original clang-cl.exe this entire line could end up being different, and I have to do this all over again. It would be nice if I could just paste this somewhere as a single string.

In regular VS there is one box where I can just paste this. Even in GDB I can just run gdb against clang-cl.exe and then pass command line arguments as a single string. This is a very big productivity hit for projects that frequently debug processes with long command lines.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the launch.json argument handling in the C/C++ debug configuration and review how the existing array form is passed to the process. Define the string form's command-line parsing behavior, including the long clang-cl example, while preserving the current array form. Done means users can paste a single argument string and launch the same child process reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.