vscode-cpptools
vscode-cpptools copied to clipboard
Issue with escaping characters in launch.json arguments
Environment
-
OS and version: 22.04.4 LTS (Jammy Jellyfish)
-
VS Code: Version: 1.89.1 Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Date: 2024-05-07T05:16:23.416Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Linux x64 6.5.0-35-generic snap
-
C/C++ extension: C/C++ v1.20.5 C/C++ Extension Pack v1.3.0
-
GDB / LLDB version: GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Command 'lldb' not found
Bug Summary and Steps to Reproduce
Description:
When configuring launch.json
in VSCode, I am encountering an issue with properly escaping double quotes in my arguments. My current configuration looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Program",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/program.exe",
# args under discussion
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb"
}
]
}
Args under discussion
The result in arg I want is command "file"
:
- The first and most obvious args that I tried was
"args": ["-g", "command \"file\"'"]
resulting in running code thatarg
becomes:command file
and which is not as expectedcommand "file"
. - The second was
"args": ["-g", "command \\\"file\\\"'"]
resulting in running code thatarg
becomes:command \"file\"
, which is not what I want, but which is as expected. - The third try was
"args": ["-g", "command "file""]
which isn't correct/allowed launch.json syntax.
Isn't there a bug luring around here in the first attempt?
Thank you in advance Henrik Bach
Debugger Configurations
{
"name": "Debug C Program",
"type": "cppdbg", // Run
"request": "launch",
"program": "${workspaceFolder}/src/cvechecker",
# args under discussion
,"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "make-build",
"miDebuggerPath": "/usr/bin/gdb", // Adjust this path if necessary
"logging": {
"engineLogging": true
}
}
Debugger Logs
N/A
Other Extensions
N/A
Additional Information
No response