From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +eEBGrF/nmi5tQMAWB0awg (envelope-from ) for ; Thu, 14 Aug 2025 20:30:41 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=faHLL9G4; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 666A81E08D; Thu, 14 Aug 2025 20:30:41 -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 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 B5EF01E08D for ; Thu, 14 Aug 2025 20:30:40 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 081713858CDA for ; Fri, 15 Aug 2025 00:30:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 081713858CDA Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=faHLL9G4 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 993E23858D20 for ; Fri, 15 Aug 2025 00:29:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 993E23858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 993E23858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755217748; cv=none; b=iZNeAopfjQJGT63pvjlZMWE6QBq7avtbU/xUcuGkJi4GAjT3QGe/aXsY6rdOr+wRmj1K8g8TsmU0ezPy9NM40jL8XvuN375MzXq8PqoTE9gXdmmvxaP8y9/vgduUJ4bC/CJnM8qgKC4TJaV0zz07+Sk+Ft4gfR5uaEkc4NGVXWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755217748; c=relaxed/simple; bh=Z2hxU15hpilPCOKJjMyrwjpUsnIsjBJTXgvELjb7wQw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vZNASIKbDjUytC7K8ugOynbqowqqwqAYbHbb7p5szV/rSg5FPlPmuk6PmAUNty32C3Spel57rApZBxeXSa3vSNANpnISIKZwPMhebP7IgFEKQywMX2mIgxVpNsC5k67UAuXcVzQHJ65jrGudWbNO406xBYgRpaGJbW/YIgRROK8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 993E23858D20 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-76e2ea887f6so1234483b3a.2 for ; Thu, 14 Aug 2025 17:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755217746; x=1755822546; darn=sourceware.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ET2VXiPDSfOaPfL9qt5B3n0jhzhqnjnSLrGOKpe/KxU=; b=faHLL9G4iFvz2Q7o5EC6RjLeanno/b8XeLeXNlQY0Hv513s8aVBJHxIBPYBPkYpOEx +ZszjCcUlGk60mJXe3o3JrvYzp04VRI++CjFkgbvn6T91dhrQCKYRlWcIaZ9RlCWQ1MG MAuIpq87IPtxUHjRuSda4d3XgUAHWO3/2ukUXJuxpeTSnC8D7x/tP2RpgMexXu2fueS9 xLSUgyqrkmWhYQDaFOXlg8LBBCEMEzbhGosHONb/BHpqNnX/9P+Vhk41E1StorifBKm+ smObufsVrKOi7Pgg6QHyTXn9bK6B/YoqHUEbqyb5GBr0PJDXsBfzAqdznVQGalEmVikX lypQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755217746; x=1755822546; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ET2VXiPDSfOaPfL9qt5B3n0jhzhqnjnSLrGOKpe/KxU=; b=ZXHbFeIefq7ueNk+paIRXliL5RlVTdGOvHedD6hE2zvvfTu18qzUGJyp0GWjzHlnEs Tpzs9xB/PalLnw0WYw53usYp9XaSJ5NmuK63KVPzy3eFJS6GtsKeWNeYoUKlK64oc691 lY/HyppV1EHUGlcBdiqPVxfA+wr6WEgx6x9s59rbFBSLMCyMh6u5Z1Acq27vf2R+Dj0d bo4LpF+GG3AmV5+UtAd0LJ1oSKQb2zEkm8itpukHN9zgZ3FawhE0II1Ds1M3X04mqABL qm8CW6DOSerOmDUDvlbeqnh6PkM5SVGriNxzeeKwu8xZJO2Zqq3DhfqixJ+ly04S2/5e vWNQ== X-Forwarded-Encrypted: i=1; AJvYcCX+q3df9fCXobWtKXylR4TXn8avNsDZozB49gTmvWRqkcYNXMM2FbhnSh91ScQrvoj4qQsoh5i8H/lZCA==@sourceware.org X-Gm-Message-State: AOJu0YyJw2PTyeP5JLXnF5luF+PWDenB4W6O0KzDqoO+GtnTfMhkbh5i xe+4EWOmzFYCcXfBdVt2n4fC7BNdvWfoSnkybCEI9E0YClGM4FhZ5+1ORSbX/KTHXXrdsUZSD2X 1TZCY X-Gm-Gg: ASbGnct768j2BlfVgMPwSSlCra/eXjtFl3j8hZxPlQtdGpTxZx3Oyl9Ff2V1T1oP4mJ +Sw3TmmmUzTJ2w8j1t8Xdw+YpAKrENPxMHILeXz9YCYvO9GdSNhlwQsjO3JEZmbDAC+61fhXKoY u8tSw50s2g8r8ZZZpvy1eAirFTHL7D46JslV0ljzGYSUjgtDODxQhEBsJ+aw5NVmJrv/P9DlsKh fp1Y6mauY2aR1dMe2t2hMWAh67Hb+1oAK2Hnr23QWKpwx0nEXAj9yI/jwZra16B1GjTyGabM7g1 RKVyd2tvSTBO+l7CHm3wv/gktmIstO6VkTdgOueuOSXfddqR/eAqp35TMOfqCnA9e+ufB61YEp1 9ifeaZi9cmXbOQK4TVJV0wEqnonkIzdUy X-Google-Smtp-Source: AGHT+IGVQ0NGD9suz7jgYpL1mh61X62yIeEv13qvDl71tpLFXsvTMgZq6Sc9kUlNpUtIF+1Kr5G1uA== X-Received: by 2002:aa7:8881:0:b0:76b:ed13:40c4 with SMTP id d2e1a72fcca58-76e447b9b8bmr79308b3a.13.1755217746394; Thu, 14 Aug 2025 17:29:06 -0700 (PDT) Received: from localhost ([2804:14c:87d5:567d:c4e1:c717:2c29:c3f6]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-76e19a5ce3bsm6891356b3a.110.2025.08.14.17.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Aug 2025 17:29:05 -0700 (PDT) From: Thiago Jung Bauermann To: Simon Marchi Cc: Markus Metzger , gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] gdb, remote: fix set_thread () in start_remote () In-Reply-To: (Simon Marchi's message of "Thu, 14 Aug 2025 18:28:12 -0400") References: <20250805071914.3832823-1-markus.t.metzger@intel.com> <20250805071914.3832823-2-markus.t.metzger@intel.com> <87cy8yzfu4.fsf@linaro.org> User-Agent: mu4e 1.12.11; emacs 30.1 Date: Thu, 14 Aug 2025 21:29:03 -0300 Message-ID: <877bz5zauo.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain 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 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? -- Thiago