This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RFC: Inferior command line arguments


>>>>> "Eli" == Eli Zaretskii <eliz@is.elta.co.il> writes:

Eli> [Shouldn't this kind of discussions be held on gdb rather than
Eli> gdb-patches?]

I didn't want to send a patch there.

Eli> First, isn't it better to use quoteargs (sp?) function for the
Eli> quoting of the characters special to the shell, instead of
Eli> rolling our own?  I mean the function which is used by Patch and
Eli> a few other GNU packages.

Probably.  I wasn't aware of that function.

>> +/* 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.  I don't see a way to do this other than to bundle up all
the arguments into a quoted string.

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).  For many targets, arguments to the inferior simply are
disallowed.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]