This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Implementation of pipe to pass GDB's command output to the shell.
Hey Abhijit,
Thanks for keep trying to push this upstream. Only a few comments.
Abhijit Halder <abhijit.k.halder@gmail.com> writes:
> +#if defined (__MINGW32__)
> +# define DEFAULT_SHELL "cmd.exe"
> +# define OPTION_TO_SHELL "/c"
> +#else
> +# define DEFAULT_SHELL "/bin/sh"
> +# define OPTION_TO_SHELL "-c"
> +#endif
As far as I have researched, all bash-compatible shells accept `-c' as a
parameter, and all of them interpret this parameter in the same way
(i.e., "execute this command"). However, and I am not sure this is
something we should worry about or not, there might be other shells
around which do not support `-c', or expect something else. I don't
know if a check is worthwhile in this case.
> +/* Structure to encapsulate all entities associated with pipe. */
> +
> +struct pipe_obj
> +{
> + /* The delimiter to separate out gdb-command and shell-command. This can be
> + any arbitrary string without containing any whitespace. There should not
> + be any leading '-' in the delimiter. */
> + char *dlim;
I believe this can be declared as const, right? Same thing for
`gdb_cmd' below. Unfortunately, `shell_cmd' cannot be declared const
for now because is is using `skip_spaces', which does not accept a
`const char *' as argument.
Otherwise, the patch looks good to me.