From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 820973857C65 for ; Wed, 24 Nov 2021 12:22:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 820973857C65 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-151-uNFZfd-GMb62QLtLOsUFPA-1; Wed, 24 Nov 2021 07:22:22 -0500 X-MC-Unique: uNFZfd-GMb62QLtLOsUFPA-1 Received: by mail-wr1-f71.google.com with SMTP id v17-20020adfedd1000000b0017c5e737b02so452278wro.18 for ; Wed, 24 Nov 2021 04:22:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iViQL26mb8lf/dVIhCuMVB70teCG2X4sN7WDVz3zAjE=; b=LzJFb3R19ITFwxllvHQVHjmR1GzChQb+cvMaGgwBWtymCs8d5ca8awUp7HoGdk1bAN 6ytCbPyNOIY6NYGlx8jd38h5fOnyYi1Tg4mwMiUcmRSweWSZgJtq9qEzF+PpOCEHIL9P KK0qS0N1Xku5sr3xgO4z34gq1BLvsTxDBPihTqr0gbg8sr6QQpmi3ydI1YX1Hm197fI/ IwHEZFKdoBBmn76yIHRI3yvVwOWPkdLLPsWSXncaVN5Mv0eLSZHSu8lHXwuSux35Zv+s V+tKd/jk3kZX5x5WB7hckT/vKMafACiACGSf/zgjsBt5Csq07Lf5zyBFNRoCxyZcInzq QbxA== X-Gm-Message-State: AOAM532ojBcHifbtA0lmddgj02hFSpuS4FG44MlqLW+4Dl36keIrq3Sr jwZzHt6xixyzh5sEBqwD366Oy+GnEYuiyrMayeqlDPvHiECa0th2Y+ftm1QKcA29bYiUlMum7Ot gJwxgRexRIG0sSkee+Z1Pk9lM6mv5B/lddIowpA+zRDmIBEUycJOZQuBuBjqrFN5OUMdbvBDDAA == X-Received: by 2002:a5d:69ce:: with SMTP id s14mr17476367wrw.25.1637756541374; Wed, 24 Nov 2021 04:22:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJy73ZbYFWO5tj6LMHySa6EG96Qcrl/ylv9xGhgefQg40zA4ygMCsRED6jFj+gKkLkajardXaA== X-Received: by 2002:a5d:69ce:: with SMTP id s14mr17476335wrw.25.1637756541185; Wed, 24 Nov 2021 04:22:21 -0800 (PST) Received: from localhost (host86-166-129-255.range86-166.btcentralplus.com. [86.166.129.255]) by smtp.gmail.com with ESMTPSA id t17sm1531714wmq.15.2021.11.24.04.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 04:22:20 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 5/6] gdb: add assert in remote_target::wait relating to async being off Date: Wed, 24 Nov 2021 12:22:08 +0000 Message-Id: <87c0ccf934cb31c7c636dcf0198bf128f38f821f.1637756330.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 24 Nov 2021 12:22:26 -0000 While working on another patch I ended up in a situation where I had async mode disabled (with 'maint set target-async off'), but the async event token got marked anyway. In this situation GDB was continually calling into remote_target::wait, however, the async token would never become unmarked as the unmarking is guarded by target_is_async_p. We could just unconditionally unmark the token, but that would feel like just ignoring a bug, so, instead, lets assert that if !target_is_async_p, then the async token should not be marked. This assertion would have caught my earlier mistake. There should be no user visible changes with this commit. --- gdb/remote.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/remote.c b/gdb/remote.c index 25a4d3cab6e..da8ed81ba78 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8309,9 +8309,13 @@ remote_target::wait (ptid_t ptid, struct target_waitstatus *status, remote_state *rs = get_remote_state (); /* Start by clearing the flag that asks for our wait method to be called, - we'll mark it again at the end if needed. */ + we'll mark it again at the end if needed. If the target is not in + async mode then the async token should not be marked. */ if (target_is_async_p ()) clear_async_event_handler (rs->remote_async_inferior_event_token); + else + gdb_assert (!async_event_handler_marked + (rs->remote_async_inferior_event_token)); ptid_t event_ptid; -- 2.25.4