This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[review] [gdb/threads] Fix hang in stop_all_threads after killing inferior
- From: "Tom de Vries (Code Review)" <gerrit at gnutoolchain-gerrit dot osci dot io>
- To: gdb-patches at sourceware dot org
- Cc: Tankut Baris Aktemur <tankut dot baris dot aktemur at intel dot com>, Mihails Strasuns <mihails dot strasuns at intel dot com>, Pedro Alves <palves at redhat dot com>
- Date: Thu, 30 Jan 2020 09:52:10 -0500
- Subject: [review] [gdb/threads] Fix hang in stop_all_threads after killing inferior
- Auto-submitted: auto-generated
- References: <gerrit.1580307037000.Ibe1f29251fe2ff1c1991f041babbe18373c113b1@gnutoolchain-gerrit.osci.io>
- Reply-to: gnutoolchain-gerrit at osci dot 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:
> 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.
I've realized from another use of save_waitstatus that I have to set t->resumed in order to have the saved wait status noticed.
With this additional patch, I did manage to observe a difference in behaviour:
...
@@ -4777,6 +4777,7 @@ stop_all_threads (void)
{
thread_info *t = find_thread_ptid (event.target, event.ptid);
save_waitstatus (t, &event.ws);
+ t->resumed = 1;
goto done;
}
else if (event.ws.kind == TARGET_WAITKIND_NO_RESUMED
...
The difference is in what happens when I continue after the ^C is handled:
- without the two patches gdb hangs, until I press enter, after which I get the
prompt
- with the two patches, gdb just presents the prompt
--
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-CC: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Comment-Date: Thu, 30 Jan 2020 14:52:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment