You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 9f44d5d9d0903adaa9deb35d33056202e5030cb3)
Target: x86_64-unknown-linux-gnu
Debuggee:
a.out: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, with debug_info, not stripped
Issue
Arguments not passed correctly - when using double quotes.
For following launch.json file:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"terminal": "console",
"name": "Debug",
"program": "${workspaceRoot}/a.out",
"args": [
"--pass-pipeline=\"builtin.module(convert-math-to-funcs{convert-ctlz}, func.func(convert-scf-to-cf,convert-arith-to-llvm), convert-func-to-llvm, convert-cf-to-llvm, reconcile-unrealized-casts)\"",
],
"cwd": "${workspaceRoot}"
}
]
}
with this program:
#include "iostream"
using namespace std;
int main(int argc, char **argv)
{
cout << argc << endl;
for ( int i = 0; i < argc ; i ++) {
cout << *(argv + i ) << endl;
}
return 0;
}
Running lldb with program arguments as printed in debug console results in correct behaviour(on bash shell):
In order to see where the problem may lie, I tried to:
First look at the verbose logs - these are being passed the arguments as it is - i.e. with escaped " as they need to be in json format.
Look at what extension does to interpret these command - conditionally uses string-argv
I considered debugging the extension on my end by building from source however ended up getting stuck in make step which complained about missing headers ( solvable given more time but i have already spent too much time on this ).
When you specify command-line arguments as an "args": [ ] array, they are not processed by the shell. These strings are decoded as JSON strings and passed directly into the environment of the debuggee process being launched (although VSCode itself may perform some substitutions).
If you want your program to receive the argument "--pass-pipeline=builtin.module(convert-math-to-funcs{...", you can write it exactly like that. There’s no need to add extra quotes—the string will not be further split on whitespace.
Shell-like splitting using string-argv will occur only if you specify the command line as a single string, e.g., "args": "-a -b -c arg1 arg2".
OS:
VSCode version:
CodeLLDB version:
1.12.2
Compiler:
Debuggee:
Issue
Arguments not passed correctly - when using double quotes.
For following launch.json file:
with this program:
compiled with
clang++ -g a.cpp
I expect following lldb invocation:
which the debug console correctly displays:
On inspecting value of argv we can see that the second argument is:
This is unexpected - i would expect it to be:
The difference being in the presence of
"
character:Running lldb with program arguments as printed in debug console results in correct behaviour(on bash shell):
In order to see where the problem may lie, I tried to:
"
as they need to be in json format.I considered debugging the extension on my end by building from source however ended up getting stuck in make step which complained about missing headers ( solvable given more time but i have already spent too much time on this ).
Verbose logs:
Verbose log
The text was updated successfully, but these errors were encountered: