This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Preliminary work in fork_inferior
On Sep 16, 2011, at 4:43 PM, Abhijit Halder wrote:
> On Fri, Sep 16, 2011 at 5:58 PM, Tristan Gingold <gingold@adacore.com> wrote:
[…]
>> --- a/gdb/fork-child.c
>> +++ b/gdb/fork-child.c
>> @@ -126,9 +126,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
>> void (*pre_trace_fun) (void), char *shell_file_arg)
>> {
>> int pid;
>> - char *shell_command;
>> static char default_shell_file[] = SHELL_FILE;
> I don't know whether this is relevant, but I think the SHELL_FILE
> macro is defined as "/bin/sh" and this will not work for MinGW. Some
> similar comments were popped up during the review of my patch for
> adding pipe command in GDB. I'm relating this to that.
Well, given that this file deals with spawning via [v]fork+exec it won't work at all for MinGW :-)
>> - argv = (char **) xmalloc (argc * sizeof (*argv));
>> + argv = (char **) alloca (argc * sizeof (*argv));
> alloca is not a portable function I guess.
Although alloca is not part of ANSI-C, it is heavily used by GNU software and available almost everywhere.
There is even a replacement alloca function in libiberty but I am pretty sure it wasn't used for a long time.
Tristan.