gdb: allow 'set args' and run commands to contain newlines
When starting GDB it is possible to set an inferior argument that
contains a newline, for example:
shell> gdb --args my.app "abc
> def"
...
(gdb) show args
Argument list to give program being debugged when it is started is "abc'
'def".
However, once GDB is started, the only way to install an argument
containing a newline is to use the Python API.
This commit changes that.
After this commit 'set args' as well as 'run', 'start', and 'starti',
will now accept multi-line inferior arguments, e.g.:
(gdb) set args "abc
> def"
(gdb) show args
Argument list to give program being debugged when it is started is ""abc
def"".
And also:
(gdb) run "abc
> def"
... etc ...
Once GDB has presented the secondary prompt to gather the remaining
inferior arguments then it is possible for the user to quit argument
entry by sending SIGINT (usually, Ctrl-c), or sending EOF (usually,
Ctrl-d). For the 'set args' case this will abort the argument change,
leaving the arguments as they were previously. For the run style
commands, this aborts the run command completely, the inferior is not
changed, and the partially collected arguments are not installed.
On Unix hosts, arguments can be wrapped with either single or double
quotes, while on MS-Windows hosts, arguments can only be wrapped with
double quotes. This gives the expected behaviour when native
debugging, but isn't entirely accurate. If a user is cross debugging
between Unix and MS-Windows then the host machine will determine which
set of quotes is valid, which will then be incorrect for the actual
target machine. This should probably be fixed in the future, but
isn't something I plan to fix immediately. If this patch is accepted,
then I can create a bug to track this issue.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Tested-By: Guinevere Larsen <guinevere@redhat.com>
4 files changed