From patchwork Wed May 16 14:18:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 27291 Received: (qmail 16696 invoked by alias); 16 May 2018 14:27:59 -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 16678 invoked by uid 89); 16 May 2018 14:27:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 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.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 May 2018 14:27:58 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E588BB402 for ; Wed, 16 May 2018 14:18:36 +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 C56B510EE961 for ; Wed, 16 May 2018 14:18:35 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 07/10] remote: Move discard_pending_stop_replies call Date: Wed, 16 May 2018 15:18:27 +0100 Message-Id: <20180516141830.16859-8-palves@redhat.com> In-Reply-To: <20180516141830.16859-1-palves@redhat.com> References: <20180516141830.16859-1-palves@redhat.com> This helps because discard_pending_stop_replies will later become a method of remote_target. Otherwise, when we have multiple instances of remote_target, we'd have to make discard_pending_stop_replies find the inferior's target_ops, and upcast it to remote_target (if indeed a remote) to find the pending stop replies queue to clear. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * remote.c (remote_target::mourn_inferior): Move discard_pending_stop_replies call here from ... (_initialize_remote): ... here. --- gdb/remote.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index ef15eafe2a..230288b727 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -9666,6 +9666,10 @@ remote_target::mourn_inferior () { struct remote_state *rs = get_remote_state (); + /* We're no longer interested in notification events of an inferior + that exited or was killed/detached. */ + discard_pending_stop_replies (current_inferior ()); + /* In 'target remote' mode with one inferior, we close the connection. */ if (!rs->extended && number_of_live_inferiors () <= 1) { @@ -14059,9 +14063,6 @@ _initialize_remote (void) /* Hook into new objfile notification. */ gdb::observers::new_objfile.attach (remote_new_objfile); - /* We're no longer interested in notification events of an inferior - when it exits. */ - gdb::observers::inferior_exit.attach (discard_pending_stop_replies); #if 0 init_remote_threadtests ();