This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Quotes after --args
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Markus BÃhren <bhr2 at gmx dot de>
- Cc: gdb at sourceware dot org
- Date: Fri, 08 Jun 2012 17:50:07 +0300
- Subject: Re: Quotes after --args
- References: <1339164112.4081.ezmlm@sourceware.org> <20120608142102.302310@gmx.net>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Fri, 08 Jun 2012 16:21:02 +0200
> From: "Markus BÃhren" <bhr2@gmx.de>
>
> gdb --eval-command=run --batch --args test.exe -f "my testfile.txt"
>
> My program should get two arguments, '-f' and 'my testfile.txt'. However, replacing my actual program test.exe by a program that just prints the input arguments, I get the following result:
>
> C:\>gdb --eval-command=run --batch --args test.exe -f "my testfile.txt"
> [New thread 6180.0xad0]
> argv[0] = >>C:/test.exe<<
> argv[1] = >>-f<<
> argv[2] = >>my\<<
> argv[3] = >>testfile.txt<<
>
> Program exited normally.
>
> Can you help me to avoid that the file name is splitted into two arguments, with replacing the blank ' ' after 'my' by a backslash '\'? I have tried a lot of combinations of double double quotes '""', escaped double quotes '\"' and so on but I did not manage to get the file name passed as a single argument into my program.
It's a bug. GDB handles the whitespace in a way that works on Posix
platforms, but not on Windows.
> PS: Renaming the file is not an option - actually, I already simplified matters here to a file name with a blank in it.
You can always use its 8+3 alias, something like mytest~1.txt (use the
"dir /x" command from the shell prompt to see the actual name),
instead of the long name. This is a workaround, though.