From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 1DB603892019 for ; Wed, 13 May 2020 20:53:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1DB603892019 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-oJ_8Imc9MKqOsvuhFFVErA-1; Wed, 13 May 2020 16:53:41 -0400 X-MC-Unique: oJ_8Imc9MKqOsvuhFFVErA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38562872FE0 for ; Wed, 13 May 2020 20:53:40 +0000 (UTC) Received: from cascais.Home (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2CBB6154C for ; Wed, 13 May 2020 20:53:39 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v8 0/6] Handle already-exited threads in 'stop_all_threads' Date: Wed, 13 May 2020 21:53:32 +0100 Message-Id: <20200513205338.14233-1-palves@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2020 20:53:44 -0000 Here's v8 of Tankut's series that fixes an infinite loop when GDB attempts to stop a thread in 'stop_all_threads', if the thread has already died. The problem is fixed by handling waitstatuses that denote exiting. It also includes a broader change to handle the case of a whole process exiting while GDB is stopping all threads. I'm resending the whole series for Tankut under a new cover letter because I find that sending just chunks of the series makes it hard to piece things together and make sense of where we are. Compared to v7, the main change is in the last patch of the series. I've thought through how to handle the case of a process exiting while we're stopping all threads in stop_all_threads. This version switches back to avoiding deleting the last thread of an inferior in remote.c's target_update_thread_list implementation instead of the previous proposal of not deleting threads with a status pending and re-adding threads in stop_all_threads. See the updated tail end of the commit log of the last patch, which describes the new change in more detail. It then tweaks a few things in common code related to that change, and also makes the new testcases spawn more than 2 inferiors. Tankut Baris Aktemur (6): gdb: protect some 'regcache_read_pc' calls gdb/infrun: move a 'regcache_read_pc' call down to first use gdb/infrun: extract out a code piece into 'mark_non_executing_threads' function gdb: introduce 'all_non_exited_process_targets' and 'switch_to_target_no_thread' gdb/infrun: enable/disable thread events of all targets in stop_all_threads gdb/infrun: handle already-exited threads when attempting to stop gdb/infrun.c | 188 +++++++++++++++++++++------------ gdb/process-stratum-target.c | 24 +++++ gdb/process-stratum-target.h | 10 ++ gdb/regcache.c | 18 ++++ gdb/remote.c | 20 ++++ gdb/testsuite/gdb.base/annota1.exp | 2 +- gdb/testsuite/gdb.cp/annota2.exp | 2 +- gdb/testsuite/gdb.multi/multi-exit.c | 22 ++++ gdb/testsuite/gdb.multi/multi-exit.exp | 138 ++++++++++++++++++++++++ gdb/testsuite/gdb.multi/multi-kill.c | 42 ++++++++ gdb/testsuite/gdb.multi/multi-kill.exp | 127 ++++++++++++++++++++++ gdb/thread.c | 2 +- gdbsupport/common-regcache.h | 5 + 13 files changed, 531 insertions(+), 69 deletions(-) create mode 100644 gdb/testsuite/gdb.multi/multi-exit.c create mode 100644 gdb/testsuite/gdb.multi/multi-exit.exp create mode 100644 gdb/testsuite/gdb.multi/multi-kill.c create mode 100644 gdb/testsuite/gdb.multi/multi-kill.exp base-commit: f7e23710fcb7133a3bbe7795ad0ddd2defca358a -- 2.14.5