From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19703 invoked by alias); 5 Aug 2011 15:08:54 -0000 Received: (qmail 19693 invoked by uid 22791); 5 Aug 2011 15:08:53 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ey0-f169.google.com (HELO mail-ey0-f169.google.com) (209.85.215.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Aug 2011 15:08:39 +0000 Received: by eye22 with SMTP id 22so2038022eye.0 for ; Fri, 05 Aug 2011 08:08:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.7.8 with SMTP id b8mr732711bkb.196.1312556918082; Fri, 05 Aug 2011 08:08:38 -0700 (PDT) Received: by 10.204.15.23 with HTTP; Fri, 5 Aug 2011 08:08:38 -0700 (PDT) In-Reply-To: References: <201108041029.37721.pedro@codesourcery.com> Date: Fri, 05 Aug 2011 15:08:00 -0000 Message-ID: Subject: Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell. From: Abhijit Halder To: Tom Tromey Cc: Pedro Alves , gdb-patches@sourceware.org, Sergio Durigan Junior , Jan Kratochvil Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00113.txt.bz2 On Fri, Aug 5, 2011 at 8:35 PM, Abhijit Halder 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 wrote: >>>>>>> "Pedro" =3D=3D Pedro Alves writes: >> >> I haven't really read this thread yet, but I wanted to chime in... >> >>>> + =A0 =A0 =A0pipe->handle =3D 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 >> >