From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8crsD83Gnmgm5AMAWB0awg (envelope-from ) for ; Fri, 15 Aug 2025 01:34:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1755236045; bh=A9zST+ABBQzM3Sgoo9MFBbjGAywM5l2YjLBVdiHoJEg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ne2NcP5TYnk95tBa/ml/hmx2AuMP7iZglmnQ8kGXdKd8FWLkzY6bN46dJ5/J0fgLX VE5oOjtsWncm4GKBVdhurOb3SKNl/VBX6JwjZlFyeV6fLMXYUtXS6D4pjvLcLZR6K4 s5d1F4UVCO11NYo2zjAfIZK3jFOFYdhYfNFCKOQE= Received: by simark.ca (Postfix, from userid 112) id 323941E0B3; Fri, 15 Aug 2025 01:34:05 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=V9X9Wnh0; dkim-atps=neutral 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 A4ACE1E08D for ; Fri, 15 Aug 2025 01:34:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F25F3858D20 for ; Fri, 15 Aug 2025 05:34:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F25F3858D20 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=V9X9Wnh0 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id CBECE3858D20 for ; Fri, 15 Aug 2025 05:33:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBECE3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CBECE3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755236012; cv=none; b=MVOxJ63Lf/lxGrFI7jss6s7LOqWz4jvX0891nX0oYeeeW57B3hBrjBl6hBgU1nHwAyZ0QD0kDl779MJi9Jr4waMJ8DNuY528+MK+WFrvoLBpGR9YUxAJiMdZ0FD61SnxqWBbzD1+kQM5Fqqp7FOAQEVEu7jwKPO7wROOYicgZiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755236012; c=relaxed/simple; bh=A9zST+ABBQzM3Sgoo9MFBbjGAywM5l2YjLBVdiHoJEg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=BPj7FKJY86DlUY86RPETjCRFmU++gmdZ24Lo2kzbvWrKcefFddZjvEcxIentnnO2BU1GFQTpphMZmYhb6SbOdaljaYlgbIr0igwDbiIqXuAjmsVNSSG7CduIVjp/4MdLJhtHVxwCuKfzPiaNjkiCA8VbzluMzXBFbH/pAIvhU3k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CBECE3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1755236011; bh=A9zST+ABBQzM3Sgoo9MFBbjGAywM5l2YjLBVdiHoJEg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=V9X9Wnh0EYtXeRI53Uv/nyco+VtUbQX57ry8dsIGY8EgmlyvdJyirbKPxHbyNANmT cGXdQUkU56dDvOdk/mSNECHYf3azqV3VEDwyALDCUvLheoRc5RlMHhFA2WSwpSHUeF /a+fulW96EMxKGmfXfaykddtwjK8S4UPQSmvYqw4= Received: by simark.ca (Postfix) id 9FBB01E08D; Fri, 15 Aug 2025 01:33:31 -0400 (EDT) Message-ID: Date: Fri, 15 Aug 2025 01:33:31 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] gdb, remote: fix set_thread () in start_remote () To: Thiago Jung Bauermann Cc: Markus Metzger , gdb-patches@sourceware.org References: <20250805071914.3832823-1-markus.t.metzger@intel.com> <20250805071914.3832823-2-markus.t.metzger@intel.com> <87cy8yzfu4.fsf@linaro.org> <877bz5zauo.fsf@linaro.org> Content-Language: en-US From: Simon Marchi In-Reply-To: <877bz5zauo.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 2025-08-14 20:29, Thiago Jung Bauermann wrote: > Simon Marchi writes: > >> On 8/14/25 12:29 AM, Thiago Jung Bauermann wrote: >>> Markus Metzger writes: >>>> - set_continue_thread (minus_one_ptid); >>>> + set_general_thread (any_thread_ptid); >>>> >>>> if (thread_count (this) == 0) >>>> { >>> >>> Also, your explanation implies that the doc comment in >>> remote_target::set_thread isn't quite right. What about changing it to >>> something along the following lines? >>> >>> -/* If PTID is MAGIC_NULL_PTID, don't set any thread. If PTID is >>> - MINUS_ONE_PTID, set the thread to -1, so the stub returns the >>> - thread. If GEN is set, set the general thread, if not, then set >>> - the step/continue thread. */ >>> +/* If PTID is MAGIC_NULL_PTID or ANY_THREAD_PTID, set the thread to 0. >>> + If PTID is MINUS_ONE_PTID, set the thread to -1. If GEN is set, set >>> + the general thread, if not, then set the step/continue thread. If >>> + the thread is 0 or -1 and GEN is set, the stub returns the thread in >>> + the qC packet reply. */ >> >> The parts "set the thread to 0" and "set the thread to -1" seem not very >> useful to me. What does that mean concretely? It would be more useful >> to explain what that instruct the remote target to do. >> >> My understanding is that passing either MAGIC_NULL_PTID or >> ANY_THREAD_PTID will result in sending `Hg0` or `Hc0`. Passing >> MINUS_ONE_PTID will result in sending `Hg-1` or `Hc-1`. >> >> On the other side, all of these will result in variable THREAD_ID being >> set to null_ptid. For Hg, we'll arbitrarily pick the first thread. For >> Hc, we'll set cs.cont_thread to null_ptid. >> >> Does that sound right? > > For gdbserver, yes. My main doubt is whether we can assume other stubs > "out there" behave the same way or do they treat Hg0 and Hg-1 > differently? The comment and code in remote_target::set_thread assume > the latter, so is that a bug? About the other stubs: I can't really help you there, I think the answer is that we'll never really know. Can you clarify what you think might be a bug? Simon