Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
31 Views

VTune breaks program arguments with escaped double quotes

To demonstrate this problem I have the following (Windows) program which just prints its arguments:

c:\dev>print_args.exe "{\"foo\": 123}"
arg[0]: print_args.exe
arg[1]: {"foo": 123}

If I run this using VTune (GUI or command line doesn't matter, I'll use the command line for demonstration purposes):

c:\dev>vtune -collect hotspots -- c:\dev\print_args.exe "{\"foo\": 123}"
vtune: Warning: Hardware collection of CPU events is not possible on this system. Microarchitecture performance insights will not be available.
vtune: Warning: To collect microarchitecture performance insights, run the product as administrator.
vtune: Collection started. To stop the collection, either press CTRL-C or enter from another console window: vtune -r c:\dev\r000hs -command stop.
arg[0]: c:\dev\print_args.exe
arg[1]: {foo: 123}
...

We can see that the double quotes around "foo" have been stripped from the arguments sent to the program. This is breaking our actual application which expects to receive a valid JSON string as input.

Is there a better way to report this issue other than the forum? This is quite a big deal for us.

0 Kudos
3 Replies
Highlighted
Employee
23 Views

Hi.

As fast workaround, could you wrap your application with params by batch script?

run.bat

c:\dev\print_args.exe "{\"foo\": 123}"
vtune -collect hotspots -- RUN_BAT_DIR\run.bat

    Thanks, Kirill

0 Kudos
Highlighted
Beginner
20 Views

It seems there is a difference between the command-line and GUI handling of this.

The GUI workaround is to use \\" instead of \" but this requires hacking/changing the command line options if you are inheriting the settings from Visual Studio.

0 Kudos
Highlighted
Beginner
18 Views

My use case currently is using VTune in combination with the Visual Studio plugin/add-on so these command-line arguments come from the project's Debugger settings. It seems we can workaround this by manually overriding the inherited settings and adding extra \ to the \".

0 Kudos