[RFC] Support of quoted string in argument of dump, restore and append commands.
Denis PILAT
denis.pilat@st.com
Tue Dec 2 09:20:00 GMT 2008
Hello everyone,
In the actual implementation of dump/restore/append command, I found it
was impossible to manage files that contains spaces.
Whereas some other commands like file, symbol-file, ...etc.. accept the
handling of quoted arguments, dump/restore/append do not.
You'll find attached the file cli-dump.patch that implements all the
above, allowing quoting arguments to these commands so allowing having
spaces in file names and in any arguments. This implementation uses
buildargv.
Then using restore command, I found that the "binary" argument was not
documented in the "help restore command", I add it and change the
gdb.base/help.exp as well.
Then I discovered that the gdb.base/dump.exp use this kind of command:
dump srec mem FILE START STOP
where the only the last argument can contains spaces. That is a little
bit strange, why START should be a space less expression and STOP could
contain whatever you want ?
Same remark for all similar command and for
restore FILE "binary" OFFSET START END
In the actual implementation, only END argument could contains complex
expressions with spaces. Of course the actual testsuite has taken that
into account and make complex expression only for the last argument.
My implementation treats all arguments with same rules, I'm using
buildargv function that's pretty well for that. If user want to use
spaces in any argument, he must use double or single quotes.
I add checking about the number of arguments and if user overpass it,
gdb prints "Too much arguments." and does not execute the command.
Please give me some feedback on what I did,
I can also adopt the policy to parse the last argument like is was
before, considering that all stuff after N-1 argument is to be
considered as the last one.
May be I can add some more test in the testsuite as well ?
As you will see, I've removed lot of dead code in cli-dumps.c, may be
you'd like that to be part of another patch !
Waiting for your feedback
Cheers
Denis PILAT / STMicroelectronics
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cli-dump.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20081202/3acbdf82/attachment.ksh>
More information about the Gdb-patches
mailing list