From patchwork Thu Oct 17 22:50:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 35108 Received: (qmail 106328 invoked by alias); 17 Oct 2019 22:50:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 106269 invoked by uid 89); 17 Oct 2019 22:50:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=realizes X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Oct 2019 22:50:35 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29946796EB for ; Thu, 17 Oct 2019 22:50:34 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFA091001B08 for ; Thu, 17 Oct 2019 22:50:33 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 06/24] Don't check target is running in remote_target::mourn_inferior Date: Thu, 17 Oct 2019 23:50:08 +0100 Message-Id: <20191017225026.30496-7-palves@redhat.com> In-Reply-To: <20191017225026.30496-1-palves@redhat.com> References: <20191017225026.30496-1-palves@redhat.com> I believe the tail end of remote_target::mourn_inferior is broken, and it's been broken for too long to even bother trying to fix. Most probably nobody needs it. If the code is reached and we find the target is running, we'd need to resync the thread list, at least, since generic_mourn_inferior got rid of all the threads in the inferior, otherwise, we'd hit an assertion on the next call to inferior_thread(), for example. A "correct" fix would probably involve restarting the whole remote_target::start_remote requence, exactly as if we had completely disconnected and reconnected from scratch. Note that regular stub debugging usually uses plain target remote, but this code is only reachable in target extended-mode: - The !remote_multi_process_p check means that it's only reacheable if the stub does not support multi-process. I.e., there can only ever be one live process. - remote_target::mourn_inferior has this at the top: /* In 'target remote' mode with one inferior, we close the connection. */ if (!rs->extended && number_of_live_inferiors () <= 1) { unpush_target (this); /* remote_close takes care of doing most of the clean up. */ generic_mourn_inferior (); return; } Which means that if we only had one live inferior (which for our case, must be true), we'll have closed the connection already, unless we're in extended-remote mode. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * remote.c (remote_target::mourn_inferior): No longer check whether the target is running. --- gdb/remote.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index 11853a9c12..f74881a3c1 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -9835,26 +9835,6 @@ remote_target::mourn_inferior () /* Call common code to mark the inferior as not running. */ generic_mourn_inferior (); - - if (!have_inferiors ()) - { - if (!remote_multi_process_p (rs)) - { - /* Check whether the target is running now - some remote stubs - automatically restart after kill. */ - putpkt ("?"); - getpkt (&rs->buf, 0); - - if (rs->buf[0] == 'S' || rs->buf[0] == 'T') - { - /* Assume that the target has been restarted. Set - inferior_ptid so that bits of core GDB realizes - there's something here, e.g., so that the user can - say "kill" again. */ - inferior_ptid = magic_null_ptid; - } - } - } } bool