Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Tom de Vries (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Cc: Mihails Strasuns <mihails.strasuns@intel.com>,
	Pedro Alves <palves@redhat.com>
Subject: [review] [gdb/threads] Fix hang in stop_all_threads after killing inferior
Date: Wed, 29 Jan 2020 16:13:00 -0000	[thread overview]
Message-ID: <20200129160212.E3DF920AF7@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1580307037000.Ibe1f29251fe2ff1c1991f041babbe18373c113b1@gnutoolchain-gerrit.osci.io>

Tom de Vries has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/759
......................................................................


Patch Set 1:

> Patch Set 1:
> 
> This seems very similar to https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/133
> - I don't think there should be any logic specific to SIGKILL here. It seems like a
> general race condition for early termination while `stop_all_threads` is being executed.

Thanks for noticing, that's useful.

FWIW, I looked over the review comments there, and noticed the suggestion to "leave the TARGET_WAITKIND_EXITED/TARGET_WAITKIND_SIGNALLED event pending", which I tried using this additional patch:
...
diff --git a/gdb/infrun.c b/gdb/infrun.c
index e34ddc83b45..c1035c25d7f 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4774,7 +4774,11 @@ stop_all_threads (void)
 
          if (event.ws.kind == TARGET_WAITKIND_SIGNALLED
              && event.ws.value.sig == GDB_SIGNAL_KILL)
-           goto done;
+           {
+             thread_info *t = find_thread_ptid (event.target, event.ptid);
+             save_waitstatus (t, &event.ws);
+             goto done;
+           }
          else if (event.ws.kind == TARGET_WAITKIND_NO_RESUMED
              || event.ws.kind == TARGET_WAITKIND_THREAD_EXITED
              || event.ws.kind == TARGET_WAITKIND_EXITED
...

But I didn't notice any difference in behaviour.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ibe1f29251fe2ff1c1991f041babbe18373c113b1
Gerrit-Change-Number: 759
Gerrit-PatchSet: 1
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Reviewer: Tom de Vries <tdevries@suse.de>
Gerrit-CC: Mihails Strasuns <mihails.strasuns@intel.com>
Gerrit-Comment-Date: Wed, 29 Jan 2020 16:02:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


  parent reply	other threads:[~2020-01-29 16:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 14:11 Tom de Vries (Code Review)
2020-01-29 15:33 ` Mihails Strasuns (Code Review)
2020-01-29 16:13 ` Tom de Vries (Code Review) [this message]
2020-01-29 16:20 ` Tankut Baris Aktemur (Code Review)
2020-01-30 16:30 ` [review v2] " Tom de Vries (Code Review)
2020-01-30 17:36 ` Tankut Baris Aktemur (Code Review)
2020-01-30 17:42 ` Tom de Vries (Code Review)
2020-01-30 17:43 ` Tom de Vries (Code Review)
2020-01-30 17:52 ` [review v3] " Tom de Vries (Code Review)
2020-02-03 14:30 ` Tankut Baris Aktemur (Code Review)
2020-02-03 15:20 ` Tom de Vries (Code Review)
2020-02-05 19:53 ` [review v4] " Tom de Vries (Code Review)
2020-02-05 19:53 ` Tom de Vries (Code Review)

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=20200129160212.E3DF920AF7@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=gdb-patches@sourceware.org \
    --cc=gnutoolchain-gerrit@osci.io \
    --cc=mihails.strasuns@intel.com \
    --cc=palves@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