From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by sourceware.org (Postfix) with ESMTPS id 08ECB3849AD1 for ; Tue, 7 May 2024 23:43:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 08ECB3849AD1 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 08ECB3849AD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125418; cv=none; b=XZnqJ31bwmRcqTDh49BEegHlHgmjovHSA/1UWKTCR/bt3gfYlFhvAKEBWf9xx0bh9C4JPno2IZ8xfJnsSzH0zNpCGkYQWCl3/U/nKPwvG6UbMvQ8oBDimF6Av2ydB+HDjZ1kULmnczfqFS+T8uagqmYMIbA8BEzRu9lN29IOLjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125418; c=relaxed/simple; bh=DLYudgufTfEvoZYDTKaIsakwFnkfvBQMN7Sy8uVC5y4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=VQbx9wEAoPaM9PJQkKXmxtAESgnh4J7iW4EEV7iM+vBkqVdc194E99Gzg3/Lunt80Mc1fM8ih6JvIBaXqELPde6pwKhjoXl8MT/hXoPCBpMtjIj9Q+p5rlAcyoBFJbVZT02DQK5+CVtxzw+v/s2h4Q6F4O1s5KbHqnWjDu8xoGM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-41ba1ba55ffso1467865e9.1 for ; Tue, 07 May 2024 16:43:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715125415; x=1715730215; 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=YXyngzmGqlR5R5W27Xv4+ULg1J9WGVgRVB+FsA3Qq3E=; b=qEA668h9Q2Gbd4s1rkXd3MWCZrZifVyo//+OkNaaJEqeIyXe1qq3qYz51NwBUqEuoh x/ZYddPR728T87ZipY9fCchzhYvXYWrzpnbRTTPYbDX5FE+EFEujz28u+Bw0cHtOdUDY b5G9RxRRGbxoCKSBphPID6yDBUvUr2NsbG2/F7MVnny3N31pmciYd5IpsrIO9XZZcaoO nxLWpwRL3edesdTGvxTtCaZ6HmjRATb0UXzVTZoe7cGVIJ17ODDwjO8n9qSCGst0Nsu9 L6lBMeP9jUa18FUsBimiEeE/1Gw/1b2m5Orh1ciicQrExI1+QA9NsvGna43+a7rYfoVO 6m4Q== X-Gm-Message-State: AOJu0YwPQIhF+bUXzbSxUZo9VBesdyzGswRmkxVxleMHU3qj/IVXZ9aJ c/yisno5Creq3BXjNsrn24lpFXNc7qohAZo0ESpsmoFvDT6eeyc9xqV4OBlj X-Google-Smtp-Source: AGHT+IG4rqXGo0gsRakDskpZEAb53iVGvVwMv7jvNMCzoUCHJt/Dyb8bL3QK3rXOfbUZoQufVZRdvQ== X-Received: by 2002:a05:600c:138c:b0:41a:8035:af77 with SMTP id 5b1f17b1804b1-41f2d63becdmr35255505e9.12.1715125414682; Tue, 07 May 2024 16:43:34 -0700 (PDT) Received: from localhost ([2001:8a0:f908:4900:2dd1:1a0d:2b75:dc42]) by smtp.gmail.com with UTF8SMTPSA id h12-20020a05600c314c00b0041be9cb540esm199493wmo.18.2024.05.07.16.43.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 May 2024 16:43:34 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 17/34] Windows gdb: Can't pass signal to thread other than last stopped thread Date: Wed, 8 May 2024 00:42:16 +0100 Message-ID: <20240507234233.371123-18-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.7 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: Passing a signal to a thread other than the one that last reported an event would be later possible with DBG_REPLY_LATER and a 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: I32915623b5036fb902f9830ce2d6f0b1ccf1f5cf --- 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 888f85b1862..a34e230f66e 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1421,10 +1421,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.43.2