Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: [patch] Fix `shell' command for async (PR 12850)
Date: Tue, 07 Jun 2011 17:13:00 -0000	[thread overview]
Message-ID: <201106071813.24470.pedro@codesourcery.com> (raw)
In-Reply-To: <20110607152409.GA7600@host1.jankratochvil.net>

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


  reply	other threads:[~2011-06-07 17:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 15:24 Jan Kratochvil
2011-06-07 17:13 ` Pedro Alves [this message]
2011-06-07 17:28   ` Jan Kratochvil
2011-06-07 19:06   ` Joel Brobecker
2011-06-07 22:57     ` Pedro Alves
2011-06-15 17:03       ` Ulrich Weigand
2011-06-15 17:23         ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201106071813.24470.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox