From patchwork Mon Dec 2 19:47:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 102270 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D81A3858D34 for ; Mon, 2 Dec 2024 19:50:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D81A3858D34 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=default header.b=KyaKUgoA X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id E22D93858423 for ; Mon, 2 Dec 2024 19:47:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E22D93858423 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E22D93858423 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733168854; cv=none; b=rALpPxD7UiC/kkXxss+SeGgcfRNvowc/U149PpQs/+NekeJtJS5xygS3o8akIVMHioCxWnQlEwom4IHfe6DO25F1L04HMPfAMB4emweV8guR0XmBLpo4k5L/OWE/vzOjvpMjNTw+2wGV1T7g3NxIWOWZxelT934K6NtlCNaXGPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733168854; c=relaxed/simple; bh=CU/DpkDalQi6hIPsK+YKEAUpXQuAjbNhjwyR/GaS5/g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=yA6NAkjq50SG3VtENNX79txqSkYYf8kW06MtEeCCsDEjF3SerLLxLrnDBBqpuq8HfsKeVZ22NwXUjJLz4DTc6Wmani63ChxpNI7mOp5mj0l4oUI3a9nYZvKijTLlgfOy1XIWi2OSev+lTB5++XulVPm5ekcjLCzDe5V8P3Ej2AY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E22D93858423 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 4B2JlSFB042653 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 2 Dec 2024 14:47:33 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 4B2JlSFB042653 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1733168853; bh=56uCux2urU8HH5PF5i8F7o8LGNOPixvpMvLJxQFpW0o=; h=From:To:Cc:Subject:Date:From; b=KyaKUgoAwTKgANG4v3vquMxPWbW6/5MLCnTh9LSWU4T/4ye0aQI5eM3uDMl0/KgMV hNr0U94wQJV/P88oe5gbnxdSd/0h4FACJIxJO5TGjzEpbuzaaECD/MnI1ePiTUiwMj qs03tsNWpffq5yGmx5ddRTkQrLvEWvCmXILHJPJg= Received: by simark.ca (Postfix, from userid 112) id 762BD1E0C0; Mon, 2 Dec 2024 14:47:28 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-Spam-Level: X-Spam-Status: No, score=-3188.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (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 ESMTPSA id 6B9D01E05C; Mon, 2 Dec 2024 14:47:23 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] gdbserver/win32-low.cc: remove use of `all_threads` Date: Mon, 2 Dec 2024 14:47:18 -0500 Message-ID: <20241202194722.1297596-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 2 Dec 2024 19:47:28 +0000 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~patchwork=sourceware.org@sourceware.org Fix this: /home/simark/src/binutils-gdb/gdbserver/win32-low.cc: In function ‘void child_delete_thread(DWORD, DWORD)’: /home/simark/src/binutils-gdb/gdbserver/win32-low.cc:192:7: error: ‘all_threads’ was not declared in this scope; did you mean ‘using_threads’? 192 | if (all_threads.size () == 1) | ^~~~~~~~~~~ | using_threads Commit 9f77b3aa0bfc ("gdbserver: change 'all_processes' and 'all_threads' list type") changed the type of `all_thread` to an intrusive_list, without changing this particular use, which broke the build because an intrusive_list doesn't know its size (we, could, Boost's version has an option for that, but we don't need it at the moment). The subsequent commit removed `all_threads`, leading to the error above. Fix it by using the number of threads of the current process instead. My rationale: as far as I know, GDBserver on Windows only supports one process at a time, so there's no need to iterate over all processes. It would be nice if someone familiar with the Windows port could confirm (and test) this. Change-Id: I84d6226532b887d99248cf3be90f5065fb7a074a Tested-By: Hannes Domani --- gdbserver/win32-low.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 3eccfdce99e030be759ea20c66d6f78978b11a25 diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 0174a32e5d19..ef00f3452f31 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -189,7 +189,7 @@ static void child_delete_thread (DWORD pid, DWORD tid) { /* If the last thread is exiting, just return. */ - if (all_threads.size () == 1) + if (current_process ()->thread_map ().size () == 1) return; thread_info *thread = find_thread_ptid (ptid_t (pid, tid));