Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.9.2
-
None
-
macOS 10.14.6 (Mojave)
Xcode 10.3
QtCreator 4.9.2
-
-
5b33660a575e71b0eb7a70593b69d6efbd1ceebd
Description
In my run settings I have a command line argument containing spaces, "foo bar", enclosed in double quotes. When I try to run in QtCreator's debugger this always gets split into two arguments, i.e. the double quotes are ignored. This only happens in the debugger. When running outside the debugger, "foo bar" gets treated correctly as just one argument.
You can see this even with a trivial test program that just prints out argc and argv:
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
cout << "argc = " << argc << endl;
for (int i = 0; i < argc; i++)
cout << "argc[" << i << "] = " << argv[i] << endl;
return 0;
}
For example, if I run myprog "foo bar" in the debugger, I can see that
argc = 3
argv[0] = myprog
argv[1] = foo
argv[2] = bar
so it looks like the double quotes have been stripped before argument parsing happens. However when running with the exact same arguments outside the debugger I get the correct result:
argc = 2
argv[0] = myprog
argv[1] = "foo bar"
This is a major problem because it means you can't pass a filename containing spaces into your program when debugging.