From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by sourceware.org (Postfix) with ESMTPS id BA270385843B for ; Tue, 7 May 2024 23:44:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA270385843B 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 BA270385843B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125467; cv=none; b=tiq4zKcafB+EbXUybtCumXaW7h/y8te0zMaUFKYZ+TZZv2+kd+s5GFwKGhPbCuyZNwOviH7DFjd5Qh+i7eLrNc86p2aJr1En9K/s4ziXvYcVkRpyVeMFyZFv/cz4YoZpFJ8Mf166M3p8r+B/KEkI8b4Qe824KsGXaEgcd5yP2hU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125467; c=relaxed/simple; bh=YORykN5N4U0WlxzrFcd3t/zaZeg2zXlzvf4l6eya+Q8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=qpyYY/mAIJjwlvpiJ14lLHvTVA075UpbX1fQXLy5zKAOiQL23Ims/El/1cEfeP0nMZAUIneWDI5c4pSSOGJxs9cFn+yDxRglvjSATYN4c/sfRRv5XgIaA1h0AebCv2Ohr/Zx3D843UoODHUJtGpOXVkilscFroB4GNPSZ55zz38= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-41b5e74fa2fso30249385e9.1 for ; Tue, 07 May 2024 16:44:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715125462; x=1715730262; 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=5jd43yuk336UaZvEKYEpN7w33MLM5oOuMKZi2HnTcvs=; b=SXR7gwJ4jgIQqwjyFY6yPEudtMtQk+mgbSmFP+X9CbxLZh0LK2L7HQP1NN6Ltj9LL5 yyLIza0xW+rdmWeIX660LCJm8fq62P5saARX23oBFiSfPhRgyynpyYT2ADH0DiUBt6AT /dbjXGUuWo0qsxOTbAyYOaCuaJc4HEmDejWVKdFrODDhLZrZU7vCr19QCoO3UNnfL2L6 Y7LotTIctKY9Vqbc1e4jZJxFego6IXGK4eWVy+aJNsnkKYXr+6pCagopDzYdqt5eWlRH 5qQeDAgIhfAq1NdvO5lQpt8XUuRT8lZXz/kndF3ml9bMcri4XPDRxHKsmDmNEFhi7zZw qJ6w== X-Gm-Message-State: AOJu0Yxz/QSkhkT2YHR8obQfPyPAMhjFcLsVs9UatoimvXNj49Kkv3Ii X90bFLS90MSiLlPpf0eV+nZQysn0Cx8M8ke+CsnhoYYSEWL4OILzK9iYFkU2 X-Google-Smtp-Source: AGHT+IFiCHIViNlofAuCxm08Qr/HJs9gOFmHzvSU+M8awHnRHQm0jgF3u19I0tpEVheUshXXHDedqA== X-Received: by 2002:a05:600c:1f19:b0:418:4841:162a with SMTP id 5b1f17b1804b1-41f71acc475mr10106685e9.15.1715125462425; Tue, 07 May 2024 16:44:22 -0700 (PDT) Received: from localhost ([2001:8a0:f908:4900:2dd1:1a0d:2b75:dc42]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-41f882085dbsm1885225e9.41.2024.05.07.16.44.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 May 2024 16:44:22 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 27/34] Windows gdb: Change serial_event management Date: Wed, 8 May 2024 00:42:26 +0100 Message-ID: <20240507234233.371123-28-pedro@palves.net> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240507234233.371123-1-pedro@palves.net> References: <20240507234233.371123-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 7a5b57b24e1..42d98badc4c 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -532,7 +532,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); @@ -1838,6 +1837,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 @@ -1886,6 +1890,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.43.2