RFC: Inferior command line arguments

Eli Zaretskii eliz@is.elta.co.il
Fri Sep 28 07:21:00 GMT 2001


> From: Tom Tromey <tromey@redhat.com>
> Date: 28 Sep 2001 06:37:59 -0600
> 
> >> +/* Given a vector of command-line arguments, return a newly allocated
> >> +   string which, when passed to the create_inferior function, will be
> >> +   parsed to yield the same vector.
> 
> Eli> I'm probably missing something important here, but this comment begs a
> Eli> question: if all we need is to get the same vector in the end, why go
> Eli> through the pain of quoting it and then unquoting it again?  Can't we
> Eli> just sneak the original vector in somehow?
> 
> On Unix platforms, aside from some unusual situations, gdb uses the
> user's shell to invoke the inferior.  The shell, not gdb, is doing the
> unquoting.

Oh, so in the comment above that confused me you meant ``...will be
parsed _by_the_shell_ to yield the same vector'', yes?

> On other platforms gdb might do some unquoting.  I looked at a few
> (but not all), though, and generally speaking this doesn't seem to
> happen.  The Windows port passes the argument string to CreateProcess
> (I don't know how Windows unquoting is done, but presumably gdb can't
> affect it).

AFAIK, CreateProcess acts like a stock Windows shell wrt the command
line handling.

The DJGPP port emulates the shell, so it also acts like a shell.

But the quoting rules are a bit different in those two cases.



More information about the Gdb-patches mailing list