public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergey Korolev <s.korolev@ndmsystems.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] MIPS/GDB/linux-nat.c: Fix a child detach condition for uClibc-ng
Date: Thu, 14 Jun 2018 22:54:00 -0000	[thread overview]
Message-ID: <CAKo4hFJcNBoO3Qo6_4y9cHshJTQzqcuFwCDNa8H_LvPnXn-iZA@mail.gmail.com> (raw)

Current implementation expects that WIFSTOPPED (W_STOPCODE (0)) is true,
but in the uClibc-ng it is false on MIPS. The patch adds a "detach"
helper variable to avoid this corner case: WIFSTOPPED applied
only to a status filled by a waitpid call that should never return
the status with zero stop signal.
---
 gdb/linux-nat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 445b59fa4a..916de2d335 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -468,6 +468,7 @@ linux_nat_target::follow_fork (int follow_child, int
detach_fork)
       /* Detach new forked process?  */
       if (detach_fork)
  {
+   int detach = 1;
    struct cleanup *old_chain = make_cleanup (delete_lwp_cleanup,
      child_lp);

@@ -492,9 +493,11 @@ linux_nat_target::follow_fork (int follow_child, int
detach_fork)
  perror_with_name (_("Couldn't do single step"));
        if (my_waitpid (child_pid, &status, 0) < 0)
  perror_with_name (_("Couldn't wait vfork process"));
+       else
+ detach = WIFSTOPPED (status);
      }

-   if (WIFSTOPPED (status))
+   if (detach)
      {
        int signo;

-- 
2.11.0

             reply	other threads:[~2018-06-14 22:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14 22:54 Sergey Korolev [this message]
2018-07-03 19:38 ` Andrew Burgess
2018-07-04 13:36   ` Sergey Korolev
2018-07-05 12:32   ` Maciej W. Rozycki
2018-07-05 21:05     ` Sergey Korolev
2018-07-06 22:10     ` Andrew Burgess
2018-07-09 11:20       ` Maciej W. Rozycki
2018-08-01 21:31   ` Ping! " Andrew Burgess
2018-08-01 21:38     ` Sergey Korolev
2018-08-02 20:03       ` Tom Tromey

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=CAKo4hFJcNBoO3Qo6_4y9cHshJTQzqcuFwCDNa8H_LvPnXn-iZA@mail.gmail.com \
    --to=s.korolev@ndmsystems.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).