From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OGaOLQEzK2g2NyoAWB0awg (envelope-from ) for ; Mon, 19 May 2025 09:32:49 -0400 Received: by simark.ca (Postfix, from userid 112) id B886D1E11C; Mon, 19 May 2025 09:32:49 -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 706AC1E102 for ; Mon, 19 May 2025 09:32:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 24C463858405 for ; Mon, 19 May 2025 13:32:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24C463858405 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by sourceware.org (Postfix) with ESMTPS id 0AF633857B8C for ; Mon, 19 May 2025 13:24:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AF633857B8C 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 0AF633857B8C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661058; cv=none; b=WzMypexNcBZ6rt2HWDFeK0jReXbBHmr46Dw1WhHQXQV/5Uym/jYhXMtLAyRIgrj4yAh97rz66K1ryGPdOk5W6bg8/KWH3sD7PQPpBGNWlyXNLbkOGagGLES79/1+ift6W5Uats4c5/EPeiykeGoJBseSnaW6bqvvv2zr2nZQdz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661058; c=relaxed/simple; bh=46IzumG9JpwK9MKCVdryx7OGW8b5RI+yOzdUtPe5kHw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=BooJQrfczR5JttWjIfpWcALkbjaYhfxcgx9aAjmRK3AH4Ew1cqqC/2cFGHmUPdxPyFPYNIQe2Yt9LQo38snRJwIRLDawoW5Mrrk6oqjZTwAYRH/ROUPYf0Cd8MuFuF2otxbPICjiL1JUygdiJtODFHVvc0IMVphmxI8do/5sRH4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AF633857B8C Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3a376ba6f08so287956f8f.1 for ; Mon, 19 May 2025 06:24:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747661056; x=1748265856; 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=79cjbE74m/ggfqEEcEpr3z26Smp1nXEL7rmw+a++zL8=; b=oTBcIq09SE7tcERyPKJmjziQ34R0/oqv/RDMTSE8YzpN4ebXw8sew0CKK0CNEwOmeR CJACX/G8/y2hphiiePUibEM8yv9gHcXAN4aRVBJWh9MDXyuT3viji5WHWTQWIrl8EqPG aMAmzqD/1ylOBIpS1fVzLimWhL4IEayfbbTSXqlqsRjZWLoPGQbznaao10oAShZ9El/i tBkXHORW0GiouyAqqLKkKpArZYSfYV2tzT0hQJBi0Zmz/mHE5Q/lXAHOFC7vdYAea+4o 2ik2kgggILWNfL3JLmWO/1UlbGdu9NOqGj/uu2VkIHEBe+GrhuXaIcRnTffhv5B3Rpfw 7wKQ== X-Gm-Message-State: AOJu0YwC/7kTizHddLL2xB+P18o0FJx7Z4gQl65/G4J9rtYY338wEiU+ H+TDJ+NgIH+PR+Jr/vDh56BvL6XjVUlX80xWy7hgGEkqouZYcgQpPDeKOEDcqDOi X-Gm-Gg: ASbGnctdtkTtsYtDR+uTPdkiAO9spIOSK8bv0Ku6ADuoBdwZsmItkSO/bTcJDE00Ei2 StNBRJjdPiuMdQ0T7XKNfIxpuFoUCTSruZ5zZljd9C4QkwfLUDEftYjJhao+uHDsIZNcJp65fjd kKxrB0w14Bmeg+4k3RWDAqDB0ec91EppxVTbpuDMzRl/H+aEAScru7h3Q8bLE6ZPoqtQtrazgGc 1cCZJgbj92uDlaSWcCP7grbsvJQYEPm0cFb7TilqdqDEKfqQ06bOT7bDJsleDzoiytfsMqbzH0E PUzzfnHrM/bJJLfj7wTwH/+3EpOz+MqnFFVJQwAwdN8vhHwJ7hY= X-Google-Smtp-Source: AGHT+IGTtygD90r2fvFU5jYkrA3L4IU7lcbbTIV19J1vbRJTgAuykmidnREfqNOkcy+6/WE8N29h6A== X-Received: by 2002:a5d:4567:0:b0:391:4999:778b with SMTP id ffacd0b85a97d-3a35c84428fmr8708875f8f.28.1747661056465; Mon, 19 May 2025 06:24:16 -0700 (PDT) Received: from localhost ([2001:8a0:4fe9:b400:8d90:6f0d:36bf:32df]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a35ca4d1c6sm12747920f8f.2.2025.05.19.06.24.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 May 2025 06:24:16 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 22/47] Windows gdb: Can't pass signal to thread other than last stopped thread Date: Mon, 19 May 2025 14:22:43 +0100 Message-ID: <20250519132308.3553663-23-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 Passing a signal to a thread other than the one that last reported an event will be later possible with DBG_REPLY_LATER and the Windows backend working in non-stop mode. With an all-stop backend that isn't possible, so at least don't incorrectly consider passing DBG_EXCEPTION_NOT_HANDLED if the thread that we're going to call ContinueDebugEvent for is not the one that the user issued "signal SIG" on. Change-Id: I27092ecfbf0904ebce02dff07d9104d22f3d8f0e --- gdb/windows-nat.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index f86e6ae9a28..1e518f46c49 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1331,10 +1331,21 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig) if (sig != GDB_SIGNAL_0) { - if (windows_process.current_event.dwDebugEventCode + /* Note it is OK to call get_last_debug_event_ptid() from the + main thread here, because we know the process_thread thread + isn't waiting for an event at this point, so there's no data + race. */ + if (inferior_ptid != get_last_debug_event_ptid ()) + { + /* ContinueDebugEvent will be for a different thread. */ + DEBUG_EXCEPT ("Cannot continue with signal %d here. " + "Not last-event thread", sig); + } + else if (windows_process.current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) { - DEBUG_EXCEPT ("Cannot continue with signal %d here.", sig); + DEBUG_EXCEPT ("Cannot continue with signal %d here. " + "Not stopped for EXCEPTION_DEBUG_EVENT", sig); } else if (sig == windows_process.last_sig) continue_status = DBG_EXCEPTION_NOT_HANDLED; -- 2.49.0