From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id A8EEF3858D33 for ; Fri, 6 Jan 2023 00:48:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A8EEF3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca 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 3060mHKc010520 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 5 Jan 2023 19:48:21 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 3060mHKc010520 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1672966102; bh=BFNvcfvMAR/nr/VI6rvl+XO6Z3stpjiyW5SWQYm6PN0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=DqNNO/1xkWGn9mZu4Y6Mqs+c+Q7ugCDxvYiWnOjdIbM/toE1rpzgryFiDshD64hdB y1IpLlKWdAAgVafIQDmq83hqe+4aPS22w5+g4HZ0vKUsNFWn2qsFJjfK/QgO/HOE6I cCH6bId64if66yUCIUkKDv1VWjE4ahixIgFCF8oo= 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 CCC741E112; Thu, 5 Jan 2023 19:48:16 -0500 (EST) Message-ID: <47d50dda-6fe7-d366-bba3-7f514e34dfb5@polymtl.ca> Date: Thu, 5 Jan 2023 19:48:16 -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 v2 5/8] gdb: add gdbarch_up Content-Language: en-US To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Simon Marchi , Andrew Burgess References: <20230105200237.987771-1-simon.marchi@polymtl.ca> <20230105200237.987771-6-simon.marchi@polymtl.ca> <87y1qgbu5r.fsf@tromey.com> <89b747c9-bc63-b204-d9b4-1a2e3ff1f25a@efficios.com> <87tu14btor.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87tu14btor.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 6 Jan 2023 00:48:17 +0000 X-Spam-Status: No, score=-3033.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 1/5/23 15:41, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> On 1/5/23 15:31, Tom Tromey wrote: >>>>>>>> "Simon" == Simon Marchi via Gdb-patches writes: >>> > Simon> From: Simon Marchi > Simon> Add a gdbarch_up unique pointer type, that calls gdbarch_free on > Simon> deletion. This is used in the ROCm support patch at the end of this > Simon> series. >>> >>> gdbarch_free is just a wrapper around delete. >>> What if this typedef just used the default deleter instead? >>> Moving gdbarch to just use new/delete always looks pretty easy. >>> >>> Tom > > Simon> I think it would involve moving the struct gdbarch definition from gdbarch.c > Simon> to gdbarch-gen.h, right? > > Ugh, yeah, never mind. It would be nice, maybe, to convert all this so > the accessors are inlined and whatnot, but it's a much bigger job. I think it would be nice to C++-ify a bit (while keeping the same principle used today. Make all the function pointer fields private, and change all the gdbarch_* free functions to be methods instead. So a call like this: gdbarch_do_something (arch, 1, "hello"); would become arch->do_something (1, "hello"); ... which would still go through the function pointer underneath. Simon