From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32356 invoked by alias); 7 Jun 2011 17:13:45 -0000 Received: (qmail 32340 invoked by uid 22791); 7 Jun 2011 17:13:43 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jun 2011 17:13:28 +0000 Received: (qmail 17309 invoked from network); 7 Jun 2011 17:13:27 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Jun 2011 17:13:27 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch] Fix `shell' command for async (PR 12850) Date: Tue, 07 Jun 2011 17:13:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-8-generic; KDE/4.6.2; x86_64; ; ) Cc: Jan Kratochvil References: <20110607152409.GA7600@host1.jankratochvil.net> In-Reply-To: <20110607152409.GA7600@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106071813.24470.pedro@codesourcery.com> 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-06/txt/msg00098.txt.bz2 On Tuesday 07 June 2011 16:24:09, Jan Kratochvil wrote: > Hi, > > this was completely debugged by Pedro so just wrote it and posted. Thanks! And thanks for writing a test as well. > --- a/gdb/cli/cli-cmds.c > +++ b/gdb/cli/cli-cmds.c > @@ -750,7 +750,7 @@ shell_escape (char *arg, int from_tty) > } > > if (pid != -1) > - while ((rc = wait (&status)) != pid && rc != -1) > + while ((rc = waitpid (pid, &status, 0)) != pid && rc != -1) > ; Pedantically, I think this could be simplified. PID is a specific pid, not -1, and when WNOHANG is not used, waitpid(pid, ..., 0) can only return pid or -1. Thus, the loop only ever executes once. > +++ b/gdb/rs6000-nat.c > @@ -614,7 +614,7 @@ exec_one_dummy_insn (struct regcache *regcache) (Urgh, had never seen this bizarre code before. I wonder if this is still needed on any sane platform, or if it was only necessary on some ancient aix.) -- Pedro Alves