From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EDjPH3EzK2hiOCoAWB0awg (envelope-from ) for ; Mon, 19 May 2025 09:34:41 -0400 Received: by simark.ca (Postfix, from userid 112) id 7D7471E11E; Mon, 19 May 2025 09:34:41 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id CF1611E102 for ; Mon, 19 May 2025 09:34:40 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8998F3858405 for ; Mon, 19 May 2025 13:34:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8998F3858405 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by sourceware.org (Postfix) with ESMTPS id 6D0553858289 for ; Mon, 19 May 2025 13:24:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6D0553858289 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6D0553858289 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661090; cv=none; b=frhynzvRzNCEZ9oQjgm1dQVBIHgmAVwQQKWtoDTGf7+N4anAVhCpDWoDCXhDIZH87zuY1CN5WEgqwZJJowvB1EeKqdyz+mq8sItKJu5kYiTZSW+W+dj0O9L1RMMMXz3gfpv6Q3749WsqBNkauk7ZtU5PzPbUVWrIJMCSeyr90ck= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661090; c=relaxed/simple; bh=sSlL7RbNg5f1ASOni521OdNazuzKwnTd/M0coJZbiLA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Cp7Cx402pGuFjowjRBzvmA04cM8uOzQgef+Q9QcZqkT5kB1N7Ymv43GHAitl9M32dTXLuS/wEsXdjY6TQLRYfLPLUNPblHoehdV61XMqFGS+J+yOr/Xvg1Jm3LwuzMPiQW9GBcUhvLVB0fZDbLxZMdUrcdejCnOWDNfOQKL8Pyk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D0553858289 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-43cf06eabdaso42668455e9.2 for ; Mon, 19 May 2025 06:24:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747661089; x=1748265889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LSkyzW6GkpeJDPYoTQnsoWOe9Gp1bhzbc57RoB2BM5E=; b=ETd4eRSsjfcbY2Q33QnZHGr1cT6uIhN4tfHwcwyvB0p2T+woro137hb/OW1s90Gd/D RH1sW685upp3FXT/2jIlRkOUgn78f4CRrUxb919SaE4/U9BFW1h1xpb8BQ/xALZEJZf6 QY/zenZS3tfxRhRMYAxyPa5J9aJ+oAxTDyLvL4cJbQ5Z/lUha2koAfzWMJDNZqQLycgi yKQb2dhj8Wqv0KOEzA+/ExyxLfCq7xSyzBzXZbmhtor6fUgS7hfMlLSffUtXio/golf1 0w/JOz04iMRlR7zCOmhmisWEA6wCffDSmPRAec6kLYtI9pA8tRKKgZwe8nuRC9PRg7pA 4ryA== X-Gm-Message-State: AOJu0Yz1wFJMxxe4c8zX0m1X+YLMWyOwBl+UpR6zZVa5IUJOlrf0yuc+ 1lPcry+qaQpfU2/CVi8gnot+jzYggs+LddGm/n0pLJolybrfVK5Tz0U/gpbuRJCS X-Gm-Gg: ASbGncu+qg9XdgmVtjVldV/CfVKUd2RlmrU9bl5i3RtkQ0FCJQgb7PonrQ20eegDijf mRoxAFBZW4utouKwds/DFbEsJo9D1EA3gVwNF8WlvzyocAM4ksVJ7kO8TINMTmHbvrRjc0+7dt9 f3NiDibkVEOPTt8c13p3R2HFNMhgqBU0SuNouQDiZhI93LxNfrw5wYFABWJbH9Yk+S4NpSmFQPa SJBZEvXCGTnMld4ZhgOv4EuSAp0+u0M2iCru/kfYx8f3PrSEuakcqMVPR5X5z8d/jywM6LPVzdV tTOiooEPwSpj8mqQN5UsHTvT56tNrt5wCkxFf0+tBadARPBYHw1E1Acjf9q5qQ== X-Google-Smtp-Source: AGHT+IFI/PGOHQtPWKu4k1YW/M8GiEaQmznX47J6o9TceD3IjG41guQHZGJB5mIM/BYlT1FS7YpD4w== X-Received: by 2002:a05:6000:2288:b0:3a1:f937:6e7c with SMTP id ffacd0b85a97d-3a35fe67a7bmr11161319f8f.22.1747661088989; Mon, 19 May 2025 06:24:48 -0700 (PDT) Received: from localhost ([2001:8a0:4fe9:b400:8d90:6f0d:36bf:32df]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a361b04236sm11709705f8f.28.2025.05.19.06.24.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 May 2025 06:24:48 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 32/47] Windows gdb: Change serial_event management Date: Mon, 19 May 2025 14:22:53 +0100 Message-ID: <20250519132308.3553663-33-pedro@palves.net> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250519132308.3553663-1-pedro@palves.net> References: <20250519132308.3553663-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org windows_nat_target::windows_continue, when it finds a resumed thread that has a pending event, does: /* There's no need to really continue, because there's already another event pending. However, we do need to inform the event loop of this. */ serial_event_set (m_wait_event); return TRUE; If we have more than one pending event ready to be consumed, and, windows_nat_target::wait returns without calling windows_nat_target::windows_continue, which it will with the non-stop support in the following patch, then we will miss waking up the event loop. This patch makes windows-nat.c manage the serial_event similarly to how linux-nat.c does it. Clear it on entry to windows_nat_target::wait, and set it if there may be more events to process. With this, there's no need to set it from windows_nat_target::wait_for_debug_event_main_thread, so the patch also makes us not do it. Change-Id: I44e1682721aa4866f1dbb052b3cfb4870fb13579 --- gdb/windows-nat.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index d5112e2e2e4..d5acbc33f69 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -525,7 +525,6 @@ windows_nat_target::wait_for_debug_event_main_thread (DEBUG_EVENT *event) { *event = m_last_debug_event; m_debug_event_pending = false; - serial_event_clear (m_wait_event); } else wait_for_debug_event (event, INFINITE); @@ -1735,6 +1734,11 @@ windows_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, { int pid = -1; + /* serial_event is a manual-reset event. Clear it first. We'll set + it again if we may need to wake up the event loop to get here + again. */ + serial_event_clear (m_wait_event); + /* We loop when we get a non-standard exception rather than return with a SPURIOUS because resume can try and step or modify things, which needs a current_thread->h. But some of these exceptions mark @@ -1783,6 +1787,10 @@ windows_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, thr->suspend (); } + /* If something came out, assume there may be more. This is + needed because there may be pending events ready to + consume. */ + serial_event_set (m_wait_event); return result; } else -- 2.49.0