From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zfXFNq1NgWCIVgAAWB0awg (envelope-from ) for ; Thu, 22 Apr 2021 06:19:25 -0400 Received: by simark.ca (Postfix, from userid 112) id D29BE1F104; Thu, 22 Apr 2021 06:19:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0FB781E54D for ; Thu, 22 Apr 2021 06:19:25 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 864FF3894422; Thu, 22 Apr 2021 10:19:24 +0000 (GMT) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id A95E7385800F for ; Thu, 22 Apr 2021 10:19:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A95E7385800F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x432.google.com with SMTP id w4so40500819wrt.5 for ; Thu, 22 Apr 2021 03:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Q6TLshnItSYMy/q8EGnK6f4Kfd2S41TTHVLVUhwqKoA=; b=CsWsbo0VqIliN/7q8b7bO1KsT/3VA+/XGzgRhFOvyQZ6i2zyPcF6DFewLpdRaIFBls V6mZCnN3L8WOKq4PXGctdJFQYb+HZCkniZwVZHhOj8SYpUiL946xR0iClIXqMyoe0ah+ UjFBeaemalYKOupMyK1LQOG/Lrb3bIMx0e7MrOgM6V6b1gT+5rOcPDc0ntg73LIkCx/F Ip8BPsT232/1fd3JGgPUMvUvxKukCJAG1XcnDg67YrQT4oDA9sgeA27JD3dx5PeAd6Bi i3qQfp6TXZ4k6qV6V6JHij1APlIp1N0vGXXXmZ8pUBwp5LkITEqe/zBQw8kzo+bUUckP 44+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Q6TLshnItSYMy/q8EGnK6f4Kfd2S41TTHVLVUhwqKoA=; b=bfwplP64GRcfpCkUwx1obqntuGFZPOy4n+ETQJ1YpoTUipulkqmC3T+V4x7nXMsFGG pjOS+PWquuUMeX6jNWNwfb9JFWV7PcZQ6GEBVYIVp6Bzm1EZv010P/C1y3q0VWKOxZ1a 7plv6qooafXbg+wu+aI6arSGbJ0gbqR5XY22nTIfKxBHUSDVdoOKWa0AdQQ+Aup/XAxo ll1YLyneQjMVlsQSCa+pqkks+lFBQUa0irJtMjeQxO8SpPfqwE3vHcOVjycGHSw121th ZR5tAUmthvhoOrJcBkYOxyLmFIn6k3j0xuO1zhrl+D8Rnt+koRCDTBIHiHudDdodWQwA P0jg== X-Gm-Message-State: AOAM530sTfFd5T4d9ZIWUivd/9iozYfcCNbhiv1gQlA2oz6YXe8SiiCJ jOzEpbHNsjzDryYl5Z3VOII0bHkfZ0qo1A== X-Google-Smtp-Source: ABdhPJzZ4IJADKBE9CKF3TUSzvNMYZRmzZRs/alZIzduUC9cwWeb8sZP3zSh9DtUpI/yiXi1uRKZQw== X-Received: by 2002:a5d:484c:: with SMTP id n12mr3055578wrs.377.1619086760818; Thu, 22 Apr 2021 03:19:20 -0700 (PDT) Received: from localhost (host109-151-46-70.range109-151.btcentralplus.com. [109.151.46.70]) by smtp.gmail.com with ESMTPSA id q17sm2820268wro.33.2021.04.22.03.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 03:19:20 -0700 (PDT) Date: Thu, 22 Apr 2021 11:19:19 +0100 From: Andrew Burgess To: Tom de Vries Subject: Re: [PATCH][gdb] Fix assert in remote_async_get_pending_events_handler Message-ID: <20210422101919.GO2610@embecosm.com> References: <20210422085127.GA7572@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210422085127.GA7572@delia> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 11:16:40 up 11 days, 21:03, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] 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: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" * Tom de Vries [2021-04-22 10:51:29 +0200]: > Hi, > > Occassionally I run into the following assert: > ... > (gdb) PASS: gdb.multi/multi-target-continue.exp: inferior 5 > Remote debugging from host ::1, port 49990^M > Process multi-target-continue created; pid = 31241^M > src/gdb/remote-notif.c:113: internal-error: \ > void remote_async_get_pending_events_handler(gdb_client_data): \ > Assertion `target_is_non_stop_p ()' failed.^M > ... > > The assert checks target_is_non_stop_p, which is related to the current > target. > > Fix this by changing the assert such that it checks non-stopness related to > the event it's handling. > > Tested on x86_64-linux. > > Any comments? This seems fine to me. I wonder though if you considered converting target_is_non_stop_p into a member function on target_ops? If we did then we would avoid having to switch targets just to ask this question. All of the helper functions that target_is_non_stop_p calls are already available as member functions so there would be no additional changes needed I think. Just a thought. Thanks, Andrew > > Thanks, > - Tom > > [gdb] Fix assert in remote_async_get_pending_events_handler > > 2021-04-16 Simon Marchi > Tom de Vries > > PR remote/27710 > * remote.c (remote_target_is_non_stop_p): New function. > * remote.h (remote_target_is_non_stop_p): Declare. > * remote-notif.c (remote_async_get_pending_events_handler): Fix assert > to check non-stopness using notif_state->remote rather current target. > > --- > gdb/remote-notif.c | 2 +- > gdb/remote.c | 11 +++++++++++ > gdb/remote.h | 1 + > 3 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c > index 5a3e1395b76..4245015ae37 100644 > --- a/gdb/remote-notif.c > +++ b/gdb/remote-notif.c > @@ -110,7 +110,7 @@ remote_async_get_pending_events_handler (gdb_client_data data) > { > remote_notif_state *notif_state = (remote_notif_state *) data; > clear_async_event_handler (notif_state->get_pending_events_token); > - gdb_assert (target_is_non_stop_p ()); > + gdb_assert (remote_target_is_non_stop_p (notif_state->remote)); > remote_notif_process (notif_state, NULL); > } > > diff --git a/gdb/remote.c b/gdb/remote.c > index 7429e1a86b3..2e365df9bba 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -14730,6 +14730,17 @@ remote_target::store_memtags (CORE_ADDR address, size_t len, > return packet_check_result (rs->buf.data ()) == PACKET_OK; > } > > +/* Return true if remote target T is non-stop. */ > + > +bool > +remote_target_is_non_stop_p (remote_target *t) > +{ > + scoped_restore_current_thread restore_thread; > + switch_to_target_no_thread (t); > + > + return target_is_non_stop_p (); > +} > + > #if GDB_SELF_TEST > > namespace selftests { > diff --git a/gdb/remote.h b/gdb/remote.h > index 18352ddb866..46bfa01fc79 100644 > --- a/gdb/remote.h > +++ b/gdb/remote.h > @@ -77,4 +77,5 @@ extern int remote_register_number_and_offset (struct gdbarch *gdbarch, > > extern void remote_notif_get_pending_events (remote_target *remote, > struct notif_client *np); > +extern bool remote_target_is_non_stop_p (remote_target *t); > #endif