From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 3E0733858D35 for ; Thu, 16 Dec 2021 18:02:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3E0733858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 045E47E04D; Thu, 16 Dec 2021 18:02:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JFKhH4rDYz4SnR; Thu, 16 Dec 2021 18:02:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 3AEA02C810; Thu, 16 Dec 2021 18:02:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Thu, 16 Dec 2021 10:02:21 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20211215224513.1626598-1-tom@tromey.com> From: John Baldwin Subject: Re: [PATCH 0/8] Rewrite gdbarch.sh in Python In-Reply-To: <20211215224513.1626598-1-tom@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639677743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SRWETIgHMODQNk9SXdePhJQBvIAFuhn4wtH8zrd8Xbk=; b=NKgxWsGl0jUj64MhVmqo3p6bMRtzqPIJds8CjFRNlsEMDoB5H71l+Tz4lkVJZaermTNSE0 EBabonCitWPdrtNkFt+UrfXhJjCCy2ErjMALEc68at51k2AfreVljjgI7s06Alzxm3TbF/ hmrMUtQoKuuvLKX6T7z1Jsob2GNjNX68sEAtExpJyoSitjqqr/NlMPkDzSkAehqXJ+Po57 cGnSA7BsfagwK0Q18oPNMTk4G1avsnBgWhNNpseVdCJfpx1lfr+MtU4E3FNgcubVXUEHtd E9v2Ja922TeWpWG2Rx3kvIdrrRz61LD8xOjuGYoHdtPK+x3k8btT1Kc9FEVhYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639677743; a=rsa-sha256; cv=none; b=flPxIZE6FbX00tvJ37Sr0SKyD3fuXEwWYTQzZUcRl4y7Lr7tXWdTlyq7+3npWDAf6jciZN aQhT+x5vtJgvBnkg1EW305aoqxRcVMpJktkzlPfAWoVytZu23k9+JJfDJtZ12oo6IovnKV QCZfRNj26SmyVkeogVtxTadwWV8et2fscQRAkMCWgKZbp4XhQdnL/XOrMq+1vbl561pa2W 5XCGpdlcwRsUuAfqJ47DsUk1VwaR1LpOZKNxk3q1G7pEjeji0BTfSQbjlCGtGCDOM7Z7f5 8eoWaqNlscnK0LrB6spFp3xePyzI0pO9KH4HkslQaGNFi8UvSD8E5lmBwSwWJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 16 Dec 2021 18:02:28 -0000 On 12/15/21 2:45 PM, Tom Tromey wrote: > I was annoyed with gdbarch.sh recently, and so I spent some time > looking into whether it could be replaced with a ".def"-style file and > then a bunch of macros. While I do think this could probably be > accomplished, it would require some very ugly macrology. > > Then, when discussing this on irc, Simon pointed out that he had > started rewriting gdbarch.sh in Python. This series takes his initial > patch and finishes it. > > There are a few benefits to this change: > > 1. It's much easier to edit the new file. It's ordinary code with > keyword arguments, rather than a single cryptic line in the middle > of the .sh file. The new format is even documented > > 2. Boilerplate code is moved out of the generator and into ordinary > files. This makes it simpler to work on, should that be needed. > > 3. The new generator is much, much faster -- around 100x. It no > longer takes seconds to run, it is instantaneous. > > I tested this by rebuilding, and by examining the changes to the > generated code. See patch #7 for that. > > Let me know what you think. I think this is definitely a step forward and that it's better to make some progress than trying to get the perfect solution. I do like having the data (components.py) separate from the generator (gdbarch.py). I would agree with Simon about possibly renaming the data to be more specific to gdbarch (e.g. gdbarch-components.py is what Simon suggested I think?). If it were YAML in the future it could be gdbarch.yaml perhaps. I did not look in detail (and did not review the actual python code at all). One thing I did find a bit odd is that the type of "variable" members (Value and Info?) is "return_type". Using "return_type" for the return type of Methods makes sense, but I think for Value and Info just using "type" might be more intuitive? Not sure though it that is a pain to deal with in gdbarch.py. -- John Baldwin