This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell.
On Fri, Aug 5, 2011 at 8:35 PM, Abhijit Halder
<abhijit.k.halder@gmail.com> wrote:
> Has pexecute deprecated by any chance? There is a comment in the code
> advising not to use this function in new code. Further, pexecute does
> not provide similar functionality. It just executes a program and
> returns the status of the program, not provide the text output from
> the program it executes. Is it a good idea to write a function (say,
> gdb_popen) as below:
>
> FILE *
> gdb_popen (const char *cmd, const char *mode)
> {
> #ifdef _WIN32
> return _popen (cmd, mode);
> #else
> return popen (cmd, mode);
> }
>
Sorry for top posting.
> On Thu, Aug 4, 2011 at 7:51 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
>>
>> I haven't really read this thread yet, but I wanted to chime in...
>>
>>>> + ? ? ?pipe->handle = popen (pipe->shell_cmd, pipe->mode);
>>
>> Pedro> I'm not sure that'll build on all supported hosts.
>> Pedro> I think on Windows that may require use of _popen instead.
>>
>> libiberty has the already-portable 'pexecute' code for this kind of
>> thing.
>>
Has pexecute deprecated by any chance? There is a comment in the code
advising not to use this function in new code. Further, pexecute does
not provide similar functionality. It just executes a program and
returns the status of the program, not provide the text output from
the program it executes. Is it a good idea to write a function (say,
gdb_popen) as below:
FILE *
gdb_popen (const char *cmd, const char *mode)
{
#ifdef _WIN32
return _popen (cmd, mode);
#else
return popen (cmd, mode);
}
>> Tom
>>
>