From patchwork Thu Mar 7 17:46:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 31772 Received: (qmail 38445 invoked by alias); 7 Mar 2019 17:46:43 -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 38437 invoked by uid 89); 7 Mar 2019 17:46:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=caught 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, 07 Mar 2019 17:46:41 +0000 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 mx1.redhat.com (Postfix) with ESMTPS id 7D62D307D97F for ; Thu, 7 Mar 2019 17:46:40 +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 15A0C5D783 for ; Thu, 7 Mar 2019 17:46:39 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Fix normal_stop latent bug Date: Thu, 7 Mar 2019 17:46:28 +0000 Message-Id: <20190307174628.24508-1-palves@redhat.com> TARGET_WAITKIND_NO_RESUMED doesn't have an associated event thread, so we shouldn't be referring to inferior_thread() assuming it points to one. This was caught on the multi-target branch, where we always switch to no-thread-selected whenever we start handling an event, exactly to catch places that incorrectly use "inferior_ptid/inferior_thread()" without switching to the right event thread / target. Here, on the branch, we assert in inferior_thread() because TARGET_WAITKIND_NO_RESUMED doesn't have an associated event thread, so inferior_ptid is still null_ptid. gdb/ChangeLog: 2019-03-07 Pedro Alves * infrun.c (normal_stop): Also check for TARGET_WAITKIND_NO_RESUMED before referring to inferior_thread(). --- gdb/ChangeLog | 5 +++++ gdb/infrun.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d3d6e5b4ee..5614e7887d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-03-07 Pedro Alves + + * infrun.c (normal_stop): Also check for + TARGET_WAITKIND_NO_RESUMED before referring to inferior_thread(). + 2019-03-07 Andrew Burgess * f-lang.c (value_from_host_double): Moved to... diff --git a/gdb/infrun.c b/gdb/infrun.c index 61467be029..33e5d434b3 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -8146,7 +8146,8 @@ normal_stop (void) if (target_has_execution) { if (last.kind != TARGET_WAITKIND_SIGNALLED - && last.kind != TARGET_WAITKIND_EXITED) + && last.kind != TARGET_WAITKIND_EXITED + && last.kind != TARGET_WAITKIND_NO_RESUMED) /* Delete the breakpoint we stopped at, if it wants to be deleted. Delete any breakpoint that is to be deleted at the next stop. */ breakpoint_auto_delete (inferior_thread ()->control.stop_bpstat);