From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id C47843858D33 for ; Wed, 1 Feb 2023 20:46:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C47843858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 3DA001E112; Wed, 1 Feb 2023 15:46:23 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1675284383; bh=kjaJ3t6CkesvsfJDODz7M26f+SwZadG3OD9n/5Zc2fk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=xRGduwbG7BE11FHs9LUd82cx93Zq268EO+cHtdr0VYJI7Zo1Buv0Kpg3W3EwvukfC uuuK8DCWOQMg3kDMVa5QUi92ROSDxRzX75aEfGaZthcAfVqPnsIq4xgYYYHjlOeJAi Nb1CCUvpdzfL10z5+8u4oAFiUrx4sG+gBgHs3FeE= Message-ID: <4ee73f43-ae93-ebf1-41ea-6cf68649fb2b@simark.ca> Date: Wed, 1 Feb 2023 15:46:22 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v3 5/8] gdbserver: Transmit target description ID in thread list and stop reply Content-Language: en-US To: Andrew Burgess , Thiago Jung Bauermann via Gdb-patches Cc: Thiago Jung Bauermann , Simon Marchi References: <20230130044518.3322695-1-thiago.bauermann@linaro.org> <20230130044518.3322695-6-thiago.bauermann@linaro.org> <87lelhtwqv.fsf@redhat.com> From: Simon Marchi In-Reply-To: <87lelhtwqv.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,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: On 2/1/23 07:07, Andrew Burgess via Gdb-patches wrote: > Thiago Jung Bauermann via Gdb-patches > writes: > >> Now that an inferior thread can have a different target description than >> its process, there needs to be a way to communicate this target >> description to GDB. So add the concept of a target description ID to the >> remote protocol, which is used to reference them and allows them to be >> transferred only once over the wire. >> >> The ID is an unsigned integer, and is sent in the 'T AA n1:r1;n2:r2;...' >> stop reply packet as a new 'n:r' pair, where n is "tdesc" and "r" is an >> unsigned integer containing the ID. >> >> It is also sent in the threads list XML in the response of a >> qXfer:threads:read request. The ID is sent as a new "tdesc" attribute of >> the node. >> >> To request the target description XML of a given ID, GDB sends the >> qXfer:features:read request with "target-id-%u.xml" as the annex, where %u >> is the target description ID. > > Luis already commented that in some locations the ID is hex, while in > others it is not explicitly stated if the value is hex or decimal. I'd > like to second that feedback, and suggest that we pick one, and use that > consistently throughout. > > My thinking is that it will be easier to understand remote packet traces > if target descriptions are requested using an ID in the safe format as > was sent to GDB, and if IDs in different packets match up. > > Thus, I would suggest we switch to using 'target-id-%x.xml' here, and > send the ID as hex in the threads reply packet. > > Additionally, I think it would be worth adding a new feature to the > qSupported packet, maybe 'per-thread-tdesc'. With this added, GDB would > be able to tell gdbserver that it supports this feature, and gdbserver > will be able to confirm that the feature is supported. > > I'm not 100% sure what we'd want to do if it turns out GDB doesn't > support the feature? Is it better to push on with GDB using the wrong > target description? Or would it be better if gdbserver exits with an > error suggesting the GDB needs updating? In some ways, _what_ we do > doesn't really matter to me, but I think having the feature will allow > us to pick a suitable error handling solution later if needed. > > I'd be happy if adding the feature was done as a separate patch in this > series, but I do think it should be part of this series. I forgot to comment on that part. Just to think out loud: - If GDB supports the new feature but GDBserver doesn't, I guess that debugging works exactly like today? What happens today if a remote thread changes its SVE vector size, the registers that GDB shows will simply not reflect the reality, they might have bogus values, but debugging will otherwise work? - If GDB does not support the new feature but GDBserver does, I guess it is problematic, because GDBserver will assume that GDB will have adjusted its expectations about the length (and layout) of the g packet response, since it told GDB about the thread-specific tdesc. But since GDB doesn't know about thread-specific tdescs, it will try to interpret the g packet response with the register layout of the process-wide tdesc, possibly leading to the infamous "Remote 'g' packet reply is too long", if the received response is longer than expected. So, I agree that we need some feature flag for this. Simon