From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sMBtFYqR2mNQTScAWB0awg (envelope-from ) for ; Wed, 01 Feb 2023 11:21:30 -0500 Received: by simark.ca (Postfix, from userid 112) id 4CA3D1E128; Wed, 1 Feb 2023 11:21:30 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=BZ+gcVZk; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E6C591E112 for ; Wed, 1 Feb 2023 11:21:29 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86F7F3858C2C for ; Wed, 1 Feb 2023 16:21:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86F7F3858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675268488; bh=5zxuf9e8xHWjDtqODuNnrt6kqtioZZjsH3FhKRYwyB4=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=BZ+gcVZkgXwqS6ujpwQQ5j6zOfOK5lh04q+7Gy85nkoLuV5zwbfJ6mU35hJzQ2hvS yZXCzfv+LYF1CkGbghjRy9LDcFJqkwEu4EoUg1uUKaHWoVUIJzpsPvDgMhlw/XHEG4 3n7iBXP9q5E/0ySQtPzgMg122qClEhlyc9uwnPUU= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id DAF773858D35 for ; Wed, 1 Feb 2023 16:21:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DAF773858D35 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)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 2FF2A1E112; Wed, 1 Feb 2023 11:21:02 -0500 (EST) Message-ID: <7970ac03-1123-d5f6-7b17-808832d43be6@simark.ca> Date: Wed, 1 Feb 2023 11:21:01 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v3 4/8] gdbserver/linux-aarch64: When thread stops, update its target description Content-Language: en-US To: Andrew Burgess , Thiago Jung Bauermann via Gdb-patches Cc: Thiago Jung Bauermann , Luis Machado References: <20230130044518.3322695-1-thiago.bauermann@linaro.org> <20230130044518.3322695-5-thiago.bauermann@linaro.org> <87pmattzjw.fsf@redhat.com> In-Reply-To: <87pmattzjw.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" >> diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h >> index 221de85aa2ee..b52eb23cc444 100644 >> --- a/gdbserver/linux-low.h >> +++ b/gdbserver/linux-low.h >> @@ -604,6 +604,12 @@ class linux_process_target : public process_stratum_target >> /* Architecture-specific setup for the current thread. */ >> virtual void low_arch_setup () = 0; >> >> + /* Allows arch-specific code to set the thread's target description when the >> + inferior stops. Returns nullptr if no thread-specific target description >> + is necessary. */ >> + virtual const struct target_desc * >> + get_thread_tdesc (const thread_info *thread); > > I think the comment for this function is not correct. The function does > not SET the thread's target description, but just GETS a target > description suitable for `thread`. It's the caller's job to do the > setting. This comment also gave me pause. How does a getter set something. I then understood that it allowed the arch-specific code to provide a thread-specific tdesc. I would suggest just: /* Return a target description for THREAD. Return nullptr if no thread-specific description is necessary. */ The other thought I had while re-reading the patch is why do we need to return and store nullptr if the thread target description is the same as the main one for the process. get_thread_tdesc could just return process_info->tdesc if we don't need a separate tdesc, and we would store that same pointer in thread_info->tdesc. And get_thread_tdesc would just return that (in fact, get_thread_tdesc might not be necessary then). Perhaps it makes some things more complicated down the road, but I can't think of anything. Simon